summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/luabridge/Source/LuaBridge/detail/dump.h
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/luabridge/Source/LuaBridge/detail/dump.h')
-rw-r--r--3rdparty/luabridge/Source/LuaBridge/detail/dump.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/3rdparty/luabridge/Source/LuaBridge/detail/dump.h b/3rdparty/luabridge/Source/LuaBridge/detail/dump.h
new file mode 100644
index 00000000000..c0668035737
--- /dev/null
+++ b/3rdparty/luabridge/Source/LuaBridge/detail/dump.h
@@ -0,0 +1,28 @@
+#include <sstream>
+#include <string>
+
+std::string dumpLuaState(lua_State *L) {
+ std::stringstream ostr;
+ int i;
+ int top = lua_gettop(L);
+ ostr << "top=" << top << ":\n";
+ for (i = 1; i <= top; ++i) {
+ int t = lua_type(L, i);
+ switch(t) {
+ case LUA_TSTRING:
+ ostr << " " << i << ": '" << lua_tostring(L, i) << "'\n";
+ break;
+ case LUA_TBOOLEAN:
+ ostr << " " << i << ": " <<
+ (lua_toboolean(L, i) ? "true" : "false") << "\n";
+ break;
+ case LUA_TNUMBER:
+ ostr << " " << i << ": " << lua_tonumber(L, i) << "\n";
+ break;
+ default:
+ ostr << " " << i << ": TYPE=" << lua_typename(L, t) << "\n";
+ break;
+ }
+ }
+ return ostr.str();
+}