From e1fce28faca94bc7a0dfe333940ae075515d6081 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Thu, 8 Jun 2017 11:05:24 +0200 Subject: Do not clear the F table when running the init code fails --- advtrains/advtrains_luaautomation/environment.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'advtrains') 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 -- cgit v1.2.3