Skip to content

Commit

Permalink
add debug info to delayed function crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
przemo1232 committed Aug 31, 2024
1 parent fd488b3 commit 93973bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ py.on_event(defines.events.on_tick, function(event)
local tick = event.tick
if not global.on_tick[tick] then return end
for _, func_details in pairs(global.on_tick[tick]) do
py.on_tick_funcs[func_details.name](table.unpack(func_details.params))
local success, err = pcall(py.on_tick_funcs[func_details.name], table.unpack(func_details.params))
if not success then error('error in on tick function ' .. func_details.name .. ': ' .. err) end
end
global.on_tick[tick] = nil
end)

0 comments on commit 93973bb

Please sign in to comment.