users.lua 882 B

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