aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-30 13:45:51 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-30 13:45:51 +0300
commit80a64341f0f2ab0ae418fdf313c9a9f04c0f8047 (patch)
treec8bb6f8cb5fed59e8ad931e907b4ee1ceee3ced9 /builtin
parentbbf3eebb1adc50a54b26541b1445204a88776795 (diff)
downloadminetest-80a64341f0f2ab0ae418fdf313c9a9f04c0f8047.tar.gz
minetest-80a64341f0f2ab0ae418fdf313c9a9f04c0f8047.tar.bz2
minetest-80a64341f0f2ab0ae418fdf313c9a9f04c0f8047.zip
Add minetest.get_connected_players()
Diffstat (limited to 'builtin')
-rw-r--r--builtin/builtin.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/builtin/builtin.lua b/builtin/builtin.lua
index 71cd4cf53..55220a607 100644
--- a/builtin/builtin.lua
+++ b/builtin/builtin.lua
@@ -837,6 +837,17 @@ function minetest.check_player_privs(name, privs)
return true, ""
end
+function minetest.get_connected_players()
+ -- This could be optimized a bit, but leave that for later
+ local list = {}
+ for _, obj in pairs(minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 1000000)) do
+ if obj:get_player_name() then
+ table.insert(list, obj)
+ end
+ end
+ return list
+end
+
--
-- Chat commands
--