users.lua 787 B

123456789101112131415161718192021222324252627
  1. -- /users.lua
  2. -- User-related functions for Modular Politics
  3. -- ===================================================================
  4. -- Function: modpol.list_users
  5. -- Params: org
  6. -- Outputs: Table of user names
  7. --
  8. -- This may be overwritten by the platform-specific interface
  9. modpol.list_users = function(org)
  10. local users = {}
  11. if (org == nil) then -- no specified org; all players
  12. if modpol.orgs["instance"]
  13. and modpol.orgs["instance"]["members"] then
  14. -- if instance exists and has membership
  15. users = modpol.orgs["instance"]["members"]
  16. else
  17. users = {}
  18. end
  19. else -- if an org is specified
  20. if (modpol.orgs[org] ~= nil) then -- org exists
  21. users = modpol.orgs[org]["members"]
  22. end
  23. end
  24. return users
  25. end