diff options
-rwxr-xr-x | include/luaglue/LuaVM.hpp | 8 | ||||
-rw-r--r-- | src/libluaglue/LuaVM.cpp | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/include/luaglue/LuaVM.hpp b/include/luaglue/LuaVM.hpp index 6055fd4..ec27a4f 100755 --- a/include/luaglue/LuaVM.hpp +++ b/include/luaglue/LuaVM.hpp @@ -36,12 +36,16 @@ class LuaVM void initialize( ); int findValue( const std::string &key ); - - void dumpStackElement( lua_State *l, int i, int indent = 0 ); + static void dumpStackElement( lua_State *l, int i, int indent = 0 ); + private: lua_State *m_lua; std::string m_sourceFilename; + + public: + LUAGLUE_DLL_VISIBLE static void dumpStack( lua_State *l ); + }; #endif diff --git a/src/libluaglue/LuaVM.cpp b/src/libluaglue/LuaVM.cpp index 9764707..c7c4b23 100644 --- a/src/libluaglue/LuaVM.cpp +++ b/src/libluaglue/LuaVM.cpp @@ -194,11 +194,16 @@ void LuaVM::dumpStackElement( lua_State *l, int i, int indent ) void LuaVM::dumpStack( ) { + dumpStack( m_lua ); +} + +void LuaVM::dumpStack( lua_State *l ) +{ cout << "-- stack --" << endl; - int top = lua_gettop( m_lua ); + int top = lua_gettop( l ); for( int i = 1; i <= top; i++ ) { - dumpStackElement( m_lua, i ); + dumpStackElement( l, i ); } cout << "-- end of stack --" << endl; |