Check for NaN values in settings

This commit is contained in:
upsilon
2017-02-11 15:44:53 +01:00
parent d6e50086c1
commit 676baa4b0b
7 changed files with 24 additions and 8 deletions

View File

@ -2,6 +2,8 @@ local function initialize_data(meta)
local NEAREST_MAX_DISTANCE = tonumber(minetest.setting_get("moremesecons_commandblock.nearest_max_distance")) or 8
if NEAREST_MAX_DISTANCE <= 0 then
NEAREST_MAX_DISTANCE = 1
elseif NEAREST_MAX_DISTANCE ~= NEAREST_MAX_DISTANCE then -- NaN
NEAREST_MAX_DISTANCE = 8
end
local commands = meta:get_string("commands")