mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 15:23:48 +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",
|
"objects_inside_area",
|
||||||
"nodename_matcher",
|
"nodename_matcher",
|
||||||
"playerdata",
|
"playerdata",
|
||||||
|
"connected_players"
|
||||||
},
|
},
|
||||||
liquid = {
|
liquid = {
|
||||||
"liquid_level_max",
|
"liquid_level_max",
|
||||||
|
@ -237,3 +237,17 @@ do
|
|||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
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