summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2013-11-18 21:01:24 -0500
committerShadowNinja <shadowninja@minetest.net>2013-11-18 21:12:09 -0500
commitf096fb4dbbfae72d4669f6ea3a25823c16e2934d (patch)
tree914993a930937fcadadf258e32d8606ed0586a09 /api.lua
parentf98312fe10b168eb4ba40c567075661e2f0060bf (diff)
Use table indices as IDs
This significantly optimizes a lot of operations and removes redundancy.
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua5
1 files changed, 1 insertions, 4 deletions
diff --git a/api.lua b/api.lua
index 9404241..88c8b1e 100644
--- a/api.lua
+++ b/api.lua
@@ -1,4 +1,3 @@
---TODO Less code duplication
-- Checks if the area is unprotected or owned by you
function areas:canInteract(pos, name)
@@ -28,9 +27,7 @@ function areas:getNodeOwners(pos)
if pos.x >= area.pos1.x and pos.x <= area.pos2.x and
pos.y >= area.pos1.y and pos.y <= area.pos2.y and
pos.z >= area.pos1.z and pos.z <= area.pos2.z then
- if area.owner ~= nil then
- table.insert(owners, area.owner)
- end
+ table.insert(owners, area.owner)
end
end
return owners