From 641c2a91796a4fbfecc80652b3dbfb0a597f02eb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 20 Jun 2019 12:38:32 +0200 Subject: HDB: Added Lua print stack utility function --- engines/hdb/lua-script.cpp | 7 +++++++ engines/hdb/lua-script.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'engines') diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 5259c10932..08d5f77fa6 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -960,6 +960,13 @@ void LuaScript::checkParameters(const char *func, int params) { } } +void lua_printstack(lua_State *L) { + int n = lua_gettop(L); + for (int i = 1; i <= n; i++) { + debug(1, "STACK %d %s %s", i, lua_tostring(L, i), luaL_typename(L, i)); + } +} + const char *LuaScript::getStringOffStack() { if (!_systemInit) { return NULL; diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h index 20cd94d331..32830b3c11 100644 --- a/engines/hdb/lua-script.h +++ b/engines/hdb/lua-script.h @@ -60,6 +60,8 @@ private: void addPatches(Common::String &chunk, const char *scriptName); }; +void lua_printstack(lua_State *L); + } #endif // !HDB_LUA_SCRIPT_H -- cgit v1.2.3