From 89f8f63d45c91b7c344885e33e72d2e4c7f9a75d Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Tue, 23 Apr 2024 13:18:59 +0200 Subject: [PATCH] Clear XP limits with no value It was a bit difficult for players to clear values. They had to provide something non-numerical to clear. --- areas.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/areas.lua b/areas.lua index 0730f8e..b219959 100644 --- a/areas.lua +++ b/areas.lua @@ -60,7 +60,9 @@ minetest.register_chatcommand("area_xp_set_max", { params = " ", description = "Set or clear the max-xp value of an area", func = function(playername, param) - local _, _, id_str, xp = string.find(param, "^([^%s]+)%s+([^%s]+)%s*$") + local matcher = param:gmatch("(%S+)") + local id_str = matcher() + local xp = matcher() if id_str == nil then return true, "Invalid syntax!" end @@ -120,7 +122,9 @@ minetest.register_chatcommand("area_xp_set_min", { params = " ", description = "Set or clear the min-xp value of an area", func = function(playername, param) - local _, _, id_str, xp = string.find(param, "^([^%s]+)%s+([^%s]+)%s*$") + local matcher = param:gmatch("(%S+)") + local id_str = matcher() + local xp = matcher() if id_str == nil then return true, "Invalid syntax!" end