From 77aa5645c55e8f44060cab8657002d7a07de0e64 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Sun, 13 Sep 2015 19:10:36 +0200 Subject: luaL_checkstack accepts NULL message. --- c-api/compat-5.3.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'c-api/compat-5.3.c') 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) { } +COMPAT53_API void luaL_checkstack (lua_State *L, int sp, const char *msg) { + if (!lua_checkstack(L, sp+LUA_MINSTACK)) { + if (msg != NULL) + luaL_error(L, "stack overflow (%s)", msg); + else { + lua_pushliteral(L, "stack overflow"); + lua_error(L); + } + } +} + + COMPAT53_API int luaL_getsubtable (lua_State *L, int i, const char *name) { int abs_i = lua_absindex(L, i); luaL_checkstack(L, 3, "not enough stack slots"); -- cgit v1.2.3-55-g6feb