aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains_luaautomation
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-04-05 13:57:09 +0200
committerorwell96 <mono96.mml@gmail.com>2017-04-29 14:53:00 +0200
commitf42b01c74bdc7e91d3def03125a0e24e6a3bb0d4 (patch)
tree58a7230e725eb15cf49eedb80254ae0fa88433d1 /advtrains/advtrains_luaautomation
parent337db2a573ccaa1672e713855022e96106679803 (diff)
downloadadvtrains-f42b01c74bdc7e91d3def03125a0e24e6a3bb0d4.tar.gz
advtrains-f42b01c74bdc7e91d3def03125a0e24e6a3bb0d4.tar.bz2
advtrains-f42b01c74bdc7e91d3def03125a0e24e6a3bb0d4.zip
Add pcall wrapper to prevent server crashes when advtrains throws an error
Instead, read save files again and restore state before the crash Rebased to latest commit
Diffstat (limited to 'advtrains/advtrains_luaautomation')
-rw-r--r--advtrains/advtrains_luaautomation/interrupt.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/advtrains/advtrains_luaautomation/interrupt.lua b/advtrains/advtrains_luaautomation/interrupt.lua
index 4d59db5..b8fc879 100644
--- a/advtrains/advtrains_luaautomation/interrupt.lua
+++ b/advtrains/advtrains_luaautomation/interrupt.lua
@@ -22,6 +22,8 @@ function iq.add(t, pos, evtdata)
end
minetest.register_globalstep(function(dtime)
+return advtrains.pcall(function()
+
if run then
timer=timer + math.min(dtime, 0.2)
for i=1,#queue do
@@ -42,6 +44,7 @@ minetest.register_globalstep(function(dtime)
end
end
end)
+end)