mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-18 06:48:28 +01:00
Fix spurious timeout errors from some callbacks
Mainly the new ones I added >_> Don't use lua_pcall, kids. tpt_lua_pcall records when control flow was "last seen" on the C++ side, so you have to call it rather than just lua_pcall if you want to avoid timeout ("script not responding") errors. For the record, I had a really hard time reproducing these errors. I had to tune the timeout to such a low value that the errors might as well have not been spurious, i.e. not much could have been done in such a short period of time anyway, bugs or no bugs.
This commit is contained in:
parent
8534be2bf9
commit
9605e0fcb9
@ -708,7 +708,7 @@ static int beginMessageBox(lua_State* l)
|
||||
cb->Push(l);
|
||||
if (lua_isfunction(l, -1))
|
||||
{
|
||||
if (lua_pcall(l, 0, 0, 0))
|
||||
if (tpt_lua_pcall(l, 0, 0, 0, false))
|
||||
{
|
||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||
}
|
||||
@ -732,7 +732,7 @@ static int beginThrowError(lua_State* l)
|
||||
cb->Push(l);
|
||||
if (lua_isfunction(l, -1))
|
||||
{
|
||||
if (lua_pcall(l, 0, 0, 0))
|
||||
if (tpt_lua_pcall(l, 0, 0, 0, false))
|
||||
{
|
||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||
}
|
||||
@ -767,7 +767,7 @@ static int beginInput(lua_State* l)
|
||||
{
|
||||
lua_pushnil(l);
|
||||
}
|
||||
if (lua_pcall(l, 1, 0, 0))
|
||||
if (tpt_lua_pcall(l, 1, 0, 0, false))
|
||||
{
|
||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||
}
|
||||
@ -799,7 +799,7 @@ static int beginConfirm(lua_State *l)
|
||||
if (lua_isfunction(l, -1))
|
||||
{
|
||||
lua_pushboolean(l, result);
|
||||
if (lua_pcall(l, 1, 0, 0))
|
||||
if (tpt_lua_pcall(l, 1, 0, 0, false))
|
||||
{
|
||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||
}
|
||||
@ -5181,7 +5181,7 @@ int LuaScriptInterface::luatpt_getscript(lua_State* l)
|
||||
tpt_lua_pushString(l, runFailed->error);
|
||||
nargs = 2;
|
||||
}
|
||||
if (lua_pcall(l, nargs, 0, 0))
|
||||
if (tpt_lua_pcall(l, nargs, 0, 0, false))
|
||||
{
|
||||
luacon_ci->Log(CommandInterface::LogError, luacon_geterror());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user