diff options
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r-- | lib/BLua.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index ba5497a..8f9f59d 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -642,12 +642,14 @@ void Lua::open_bit() { } void Lua::declarefunc(const String & name, lua_CFunction f, int i) { + checkstack(2); lua_pushstring(L, name.to_charp()); lua_pushcfunction(L, f); lua_settable(L, i); } void Lua::call(const String & f, int i, int nargs, int nresults) { + checkstack(1); lua_pushstring(L, f.to_charp()); lua_gettable(L, i); lua_insert(L, -1 - nargs - nresults); @@ -657,6 +659,7 @@ void Lua::call(const String & f, int i, int nargs, int nresults) { void Lua::call(int nargs, int nresults) throw(GeneralException) { int r; + checkstack(1); lua_pushcfunction(L, LuaStatics::luaerror); lua_insert(L, 1); _protected = true; @@ -681,6 +684,7 @@ void Lua::call(int nargs, int nresults) throw(GeneralException) { } void Lua::push(const char * s, int size) { + checkstack(); if (size < 0) { lua_pushstring(L, s); } else { @@ -830,6 +834,7 @@ void Lua::load(Handle * h, bool docall) throw (GeneralException) { lf.f = h; + checkstack(); status = lua_load(L, LuaStatics::getF, &lf, h->GetName().to_charp()); if (status) { @@ -895,6 +900,7 @@ void Lua::dumpvars_r(Handle * h, int i, int depth) throw (GeneralException) { depth++; + checkstack(); while(lua_next(L, i) != 0) { if (lua_type(L, -2) == LUA_TSTRING) { if (String(lua_tostring(L, -2)) == String("_G")) { @@ -999,6 +1005,7 @@ void Lua::dumpvars_r(Handle * h, int i, int depth) throw (GeneralException) { } Lua * Lua::thread(bool saveit) { + checkstack(); lua_State * L1 = lua_newthread(L); Lua * Lt = find(L1); if (saveit) { |