-- Area iterator by Colandus @ ******.net
function mapArea(fromPos, toPos, stack)
local pos = {x=fromPos.x, y=fromPos.y-1, z=fromPos.z}
return function()
if (pos.y < toPos.y) then
pos.y = pos.y+1
elseif (pos.x <= toPos.x) then
pos.y = fromPos.y
pos.x = pos.x+1
else
pos.x = fromPos.x
pos.y = fromPos.y
pos.z = pos.z+1
end
if (pos.x <= toPos.x and pos.y <= toPos.y or pos.z < toPos.z) then
if (stack == nil) then
return pos
else
pos.stackpos = stack
return pos, getThingfromPos(pos).uid
end
end
end
end
local fromPos = {x=x, y=y, z=z}
local toPos = {x=x, y=y, z=z}
for _, thing in mapArea(fromPos, toPos, 253) do
if isPlayer(thing.uid) == TRUE then
-- player found, now what?
return TRUE
end
end
-- no player was found, continue?
return TRUE
Pointless, you can use global storage for that.