2
0

users.lua 738 B

123456789101112131415161718192021
  1. -- ===================================================================
  2. -- Function: modpol.list_users(org)
  3. -- Overwrites function at /users.lua
  4. -- Params:
  5. -- if nil, lists instance members; if an org name, lists its members
  6. -- Output: a table with names of players currently in the game
  7. modpol.list_users = function(org)
  8. local users = {}
  9. if (org == nil) then -- no specified org; all players
  10. for _,player in ipairs(minetest.get_connected_players()) do
  11. local name = player:get_player_name()
  12. table.insert(users,name)
  13. end
  14. else -- if an org is specified
  15. if (modpol.orgs[org] ~= nil) then -- org exists
  16. users = modpol.orgs[org]["members"]
  17. end
  18. end
  19. return users
  20. end