diff options
| -rw-r--r-- | c-api/compat-5.3.c | 12 | ||||
| -rw-r--r-- | c-api/compat-5.3.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c index 34b8001..fd41798 100644 --- a/c-api/compat-5.3.c +++ b/c-api/compat-5.3.c | |||
| @@ -155,6 +155,18 @@ COMPAT53_API void luaL_checkversion (lua_State *L) { | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | 157 | ||
| 158 | COMPAT53_API void luaL_checkstack (lua_State *L, int sp, const char *msg) { | ||
| 159 | if (!lua_checkstack(L, sp+LUA_MINSTACK)) { | ||
| 160 | if (msg != NULL) | ||
| 161 | luaL_error(L, "stack overflow (%s)", msg); | ||
| 162 | else { | ||
| 163 | lua_pushliteral(L, "stack overflow"); | ||
| 164 | lua_error(L); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | |||
| 158 | COMPAT53_API int luaL_getsubtable (lua_State *L, int i, const char *name) { | 170 | COMPAT53_API int luaL_getsubtable (lua_State *L, int i, const char *name) { |
| 159 | int abs_i = lua_absindex(L, i); | 171 | int abs_i = lua_absindex(L, i); |
| 160 | luaL_checkstack(L, 3, "not enough stack slots"); | 172 | luaL_checkstack(L, 3, "not enough stack slots"); |
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index c70ea33..2309294 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h | |||
| @@ -131,6 +131,9 @@ COMPAT53_API lua_Number lua_tonumberx (lua_State *L, int i, int *isnum); | |||
| 131 | #define luaL_checkversion COMPAT53_CONCAT(COMPAT53_PREFIX, L_checkversion) | 131 | #define luaL_checkversion COMPAT53_CONCAT(COMPAT53_PREFIX, L_checkversion) |
| 132 | COMPAT53_API void luaL_checkversion (lua_State *L); | 132 | COMPAT53_API void luaL_checkversion (lua_State *L); |
| 133 | 133 | ||
| 134 | #define luaL_checkstack COMPAT53_CONCAT(COMPAT53_PREFIX, L_checkstack_53) | ||
| 135 | COMPAT53_API void luaL_checkstack (lua_State *L, int sp, const char *msg); | ||
| 136 | |||
| 134 | #define luaL_getsubtable COMPAT53_CONCAT(COMPAT53_PREFIX, L_getsubtable) | 137 | #define luaL_getsubtable COMPAT53_CONCAT(COMPAT53_PREFIX, L_getsubtable) |
| 135 | COMPAT53_API int luaL_getsubtable (lua_State* L, int i, const char *name); | 138 | COMPAT53_API int luaL_getsubtable (lua_State* L, int i, const char *name); |
| 136 | 139 | ||
