mirror of
https://github.com/love2d/love.git
synced 2026-08-14 01:20:56 +02:00
Add traceback information to the error string generated if a thread causes a Lua error.
--HG-- branch : minor
This commit is contained in:
@@ -66,6 +66,9 @@ void LuaThread::threadFunction()
|
||||
luax_require(L, "love.filesystem");
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushcfunction(L, luax_traceback);
|
||||
int tracebackidx = lua_gettop(L);
|
||||
|
||||
if (luaL_loadbuffer(L, (const char *) code->getData(), code->getSize(), name.c_str()) != 0)
|
||||
error = luax_tostring(L, -1);
|
||||
else
|
||||
@@ -77,7 +80,7 @@ void LuaThread::threadFunction()
|
||||
|
||||
args.clear();
|
||||
|
||||
if (lua_pcall(L, pushedargs, 0, 0) != 0)
|
||||
if (lua_pcall(L, pushedargs, 0, tracebackidx) != 0)
|
||||
error = luax_tostring(L, -1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user