diff --git a/minetest.lua b/minetest.lua index 3837afd..7c78480 100644 --- a/minetest.lua +++ b/minetest.lua @@ -25,6 +25,7 @@ for filename, comps in pairs{ "objects_inside_area", "nodename_matcher", "playerdata", + "connected_players" }, liquid = { "liquid_level_max", diff --git a/minetest/misc.lua b/minetest/misc.lua index 1cc0ec7..be6eb92 100644 --- a/minetest/misc.lua +++ b/minetest/misc.lua @@ -237,3 +237,17 @@ do return data end end + +function connected_players() + -- TODO cache connected players + local connected_players = minetest.get_connected_players() + local index = 0 + local len = #connected_players + return function() + if index >= len then + return + end + index = index + 1 + return connected_players[index] + end +end