summaryrefslogtreecommitdiff
path: root/pos.lua
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-05-30 17:41:41 -0400
committerShadowNinja <shadowninja@minetest.net>2014-05-30 17:41:41 -0400
commitabd6a4c7097f4086e662b5faaf0e4d0f5ec112c0 (patch)
tree99e9fadeec3971e03d24524e9edb41e528973f16 /pos.lua
parent02905caaeb48a7aa842da911f8d40f9a5ce998cf (diff)
Centralize position getting and sorting
Diffstat (limited to 'pos.lua')
-rw-r--r--pos.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/pos.lua b/pos.lua
index 3dbf07c..e4f2d25 100644
--- a/pos.lua
+++ b/pos.lua
@@ -118,12 +118,12 @@ minetest.register_chatcommand("area_pos", {
end,
})
-function areas:getPos1(playerName)
- return areas.pos1[playerName]
-end
-
-function areas:getPos2(playerName)
- return areas.pos2[playerName]
+function areas:getPos(playerName)
+ local pos1, pos2 = areas.pos1[playerName], areas.pos2[playerName]
+ if not (pos1 and pos2) then
+ return nil
+ end
+ return areas:sortPos(pos1, pos2)
end
function areas:setPos1(playerName, pos)