diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2015-09-13 19:10:36 +0200 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2015-09-13 19:10:36 +0200 |
commit | 77aa5645c55e8f44060cab8657002d7a07de0e64 (patch) | |
tree | b3991464fba89188347163315854906267fcd96d /c-api/compat-5.3.c | |
parent | 5a462cd093d57797cec2e0efc0788213ab799560 (diff) | |
download | lua-compat-5.3-0.3.tar.gz lua-compat-5.3-0.3.tar.bz2 lua-compat-5.3-0.3.zip |
luaL_checkstack accepts NULL message.v0.3
Diffstat (limited to 'c-api/compat-5.3.c')
-rw-r--r-- | c-api/compat-5.3.c | 12 |
1 files changed, 12 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"); |