From 6af528b74f2a2c6bc818777f4c2a29b7d7c55a09 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Fri, 9 Jul 2021 22:21:52 -0700 Subject: [PATCH] Properly check for nil - tonumber will emit it. This caused a few crashes on people using the creator pad. --- mods/boxes/nodes.lua | 2 +- mods/perks/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/boxes/nodes.lua b/mods/boxes/nodes.lua index 361c878..2e41091 100644 --- a/mods/boxes/nodes.lua +++ b/mods/boxes/nodes.lua @@ -631,7 +631,7 @@ do_creator_if = function(player, context) end local pmeta = player:get_meta() - local limit = tonumber(pmeta:get_string("box_create_limit") or "3") + local limit = tonumber(pmeta:get_string("boxxx_create_limit")) or 3 if (minetest.check_player_privs(name, "create") and counts.editing + counts.submitted <= limit) or minetest.check_player_privs(name, "review") then diff --git a/mods/perks/init.lua b/mods/perks/init.lua index cf2558d..3364ddf 100644 --- a/mods/perks/init.lua +++ b/mods/perks/init.lua @@ -74,7 +74,7 @@ function perks.grant(name_or_player) if accepted >= 3 then local pmeta = player:get_meta() - local limit = tonumber(pmeta:get_string("box_create_limit") or "3") + local limit = tonumber(pmeta:get_string("box_create_limit") or 3 if limit <= 3 then minetest.log("perks: granted more boxes to " .. name) announce.all(name .. " has been granted the more boxes perk!")