MCPcopy Create free account
hub / github.com/defold/defold / printStack

Function printStack

engine/script/src/test/test_script_lua.cpp:1162–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160}
1161
1162static void printStack(lua_State* L)
1163{
1164 int top = lua_gettop(L);
1165 int bottom = 1;
1166 lua_getglobal(L, "tostring");
1167 for(int i = top; i >= bottom; i--)
1168 {
1169 lua_pushvalue(L, -1);
1170 lua_pushvalue(L, i);
1171 lua_pcall(L, 1, 1, 0);
1172 const char *str = lua_tostring(L, -1);
1173 if (str) {
1174 printf("%2d: %s\n", i, str);
1175 }else{
1176 printf("%2d: %s\n", i, luaL_typename(L, i));
1177 }
1178 lua_pop(L, 1);
1179 }
1180 lua_pop(L, 1);
1181}
1182
1183static bool g_panic_function_called = false;
1184

Callers

nothing calls this directly

Calls 3

lua_gettopFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pcallFunction · 0.85

Tested by

no test coverage detected