math.floor triggers error if it gets something nil

master
Gabriel Pérez-Cerezo 2019-07-20 19:43:38 +02:00
parent 896baf8e05
commit b5e8068a99
1 changed files with 4 additions and 1 deletions

View File

@ -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)