From c3b1a506ba8920b22ee7dedf514f0f0f0b31be73 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Mon, 1 Jun 2020 14:15:00 +0200 Subject: [PATCH] fix lua table insanity --- items.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/items.lua b/items.lua index eab7f5b..7465169 100644 --- a/items.lua +++ b/items.lua @@ -18,8 +18,14 @@ if minetest.get_modpath("areas") then -- allow for players with areas privilege if not player_owns_id and minetest.check_player_privs(name, { areas=true }) then - if table.getn(current_areas) == 1 then - player_owns_id = current_areas[1] or current_areas[0] + local num_current_areas = 0 + local current_area_id = nil + for areas_id, areas_area in pairs( current_areas ) do + num_current_areas = num_current_areas + 1 + current_area_id = "a"..tostring(areas_id) + end + if num_current_areas == 1 then + player_owns_id = current_area_id else minetest.chat_send_player(name, "[creative_regions] Area ambiguous: You are in multiple areas.") minetest.after(0.2, function(pos)