Fix a crash and use nil instead of a string in certain places

This commit is contained in:
a-bad-dev 2026-02-19 18:39:24 -04:00
commit 2061af0645
3 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ core.register_chatcommand("start", {
local sucess = start_match(param)
if map_data == "nope :(" then
if not map_data then
return false, "-!- Map not found!"
end

View file

@ -117,8 +117,8 @@ function start_match(map) -- Start the match
map_data = place_map(map or "forest") -- default to forest if no map is specified
if map_data == "nope :(" then
return map_data
if not map_data then
return nil
end
set_match_state("pre_match")
@ -191,7 +191,7 @@ function end_match() -- End the match
set_match_state("not_started")
for _, player in pairs(core.get_connected_players()) do
player:set_pos -- name kept for backwards compat(spawn_pos)
player:set_pos(spawn_pos)
player:get_inventory():set_list("main", {})
player:set_inventory_formspec([[

View file

@ -7,7 +7,7 @@ function place_map(map)
if map_list[i] == map then
break
elseif i == #map_list then
return "nope :("
return nil
end
end