local function toInt(s) s = trim(s); local n = tonumber(s); return n and math.floor(n) or nil end ...