aboutsummaryrefslogtreecommitdiff
path: root/advtrains_line_automation/stoprail.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2019-07-20 19:43:38 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2019-07-20 19:43:38 +0200
commitb5e8068a99f9bf1538589614624d05c7614f13cb (patch)
tree63ca18ff31067ca77ff60e36d1b8a4bbc6fab2fe /advtrains_line_automation/stoprail.lua
parent896baf8e05c4a17f6c302edbfff27f1e96fa08f0 (diff)
downloadadvtrains-b5e8068a99f9bf1538589614624d05c7614f13cb.tar.gz
advtrains-b5e8068a99f9bf1538589614624d05c7614f13cb.tar.bz2
advtrains-b5e8068a99f9bf1538589614624d05c7614f13cb.zip
math.floor triggers error if it gets something nil
Diffstat (limited to 'advtrains_line_automation/stoprail.lua')
-rw-r--r--advtrains_line_automation/stoprail.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/advtrains_line_automation/stoprail.lua b/advtrains_line_automation/stoprail.lua
index ec4994b..0db474f 100644
--- a/advtrains_line_automation/stoprail.lua
+++ b/advtrains_line_automation/stoprail.lua
@@ -4,7 +4,10 @@
local function to_int(n)
--- Disallow floating-point numbers
- return math.floor(tonumber(n))
+ local k = tonumber(n)
+ if k then
+ return math.floor(k)
+ end
end
local function updatemeta(pos)