mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add modlib.minetest.connected_players
This commit is contained in:
parent
29ffa18ff6
commit
9ced0f6d5c
@ -25,6 +25,7 @@ for filename, comps in pairs{
|
||||
"objects_inside_area",
|
||||
"nodename_matcher",
|
||||
"playerdata",
|
||||
"connected_players"
|
||||
},
|
||||
liquid = {
|
||||
"liquid_level_max",
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user