aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-06-08 11:05:24 +0200
committerorwell96 <mono96.mml@gmail.com>2017-06-08 11:05:24 +0200
commite1fce28faca94bc7a0dfe333940ae075515d6081 (patch)
treedcce8e44ddae33ae97dcf2efee9707c5b8874ecf /advtrains
parentd78450bb7ca6e0a7c32bb5e8cadb60c9e99e860b (diff)
downloadadvtrains-e1fce28faca94bc7a0dfe333940ae075515d6081.tar.gz
advtrains-e1fce28faca94bc7a0dfe333940ae075515d6081.tar.bz2
advtrains-e1fce28faca94bc7a0dfe333940ae075515d6081.zip
Do not clear the F table when running the init code fails
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/advtrains_luaautomation/environment.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/advtrains/advtrains_luaautomation/environment.lua b/advtrains/advtrains_luaautomation/environment.lua
index ec1f7cb..0b25e87 100644
--- a/advtrains/advtrains_luaautomation/environment.lua
+++ b/advtrains/advtrains_luaautomation/environment.lua
@@ -217,12 +217,17 @@ end
function env_proto:run_initcode()
if self.init_code and self.init_code~="" then
+ local old_fdata=self.fdata
self.fdata = {}
atprint("[atlatc]Running initialization code for environment '"..self.name.."'")
local succ, err = self:execute_code({}, self.init_code, {type="init", init=true})
if not succ then
atwarn("[atlatc]Executing InitCode for '"..self.name.."' failed:"..err)
self.init_err=err
+ if old_fdata then
+ self.fdata=old_fdata
+ atwarn("[atlatc]The 'F' table has been restored to the previous state.")
+ end
end
end
end