fix error handling in events and runnables
This commit is contained in:
parent
3304bf27a6
commit
03a3062940
@ -172,7 +172,10 @@ local __post_runnables = {}
|
|||||||
function __process_post_runnables()
|
function __process_post_runnables()
|
||||||
if #__post_runnables then
|
if #__post_runnables then
|
||||||
for _, func in ipairs(__post_runnables) do
|
for _, func in ipairs(__post_runnables) do
|
||||||
func()
|
local status, result = pcall(func)
|
||||||
|
if not status then
|
||||||
|
debug.log("error in post_runnable: "..result)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
__post_runnables = {}
|
__post_runnables = {}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -136,10 +136,12 @@ bool lua::emit_event(
|
|||||||
getglobal(L, "events");
|
getglobal(L, "events");
|
||||||
getfield(L, "emit");
|
getfield(L, "emit");
|
||||||
pushstring(L, name);
|
pushstring(L, name);
|
||||||
call_nothrow(L, args(L) + 1);
|
if (call_nothrow(L, args(L) + 1)) {
|
||||||
bool result = toboolean(L, -1);
|
bool result = toboolean(L, -1);
|
||||||
pop(L, 2);
|
pop(L, 2);
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
State* lua::get_main_state() {
|
State* lua::get_main_state() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user