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

Function DeepLuaErrorFunc

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

Source from the content-addressed store, hash-verified

585}
586
587static int DeepLuaErrorFunc(lua_State* L) {
588 // Create a Lua call stack to show traceback with content
589 const char *lua_with_callstack =
590 "function deep_func()\n"
591 " error(nil)\n"
592 "end\n"
593 "function main_func()\n"
594 " deep_func()\n"
595 "end\n"
596 "main_func()\n";
597
598 // Use loadstring + call instead of dostring to let error propagate
599 int result = luaL_loadstring(L, lua_with_callstack);
600 if (result != 0) {
601 return result; // Compilation error
602 }
603 lua_call(L, 0, 0); // This will throw the error from error(nil)
604 return 0; // Never reached
605}
606
607TEST_F(ScriptTestLua, TestAssertNilNil)
608{

Callers

nothing calls this directly

Calls 1

lua_callFunction · 0.85

Tested by

no test coverage detected