Skip to content

Commit

Permalink
Clear XP limits with no value
Browse files Browse the repository at this point in the history
It was a bit difficult for players to clear values.
They had to provide something non-numerical to clear.
  • Loading branch information
SwissalpS committed Apr 23, 2024
1 parent dc5c5c3 commit 89f8f63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions areas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ minetest.register_chatcommand("area_xp_set_max", {
params = "<ID> <xp_limit>",
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
Expand Down Expand Up @@ -120,7 +122,9 @@ minetest.register_chatcommand("area_xp_set_min", {
params = "<ID> <xp_limit>",
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
Expand Down

0 comments on commit 89f8f63

Please sign in to comment.