2
0

interactions.lua 774 B

12345678910111213141516171819202122232425
  1. -- ===================================================================
  2. -- /orgs.lua
  3. -- User interaction functions for Modular Politics
  4. -- Called by modpol.lua
  5. -- ===================================================================
  6. -- Function: modpol.binary_poll_user(user, question)
  7. -- Params: user (string), question (string)
  8. -- Output:
  9. -- presents a yes/no/abstain poll to a user, returns answer
  10. modpol.binary_poll_user = function(user, question)
  11. local query = "Poll for " .. user .. " (y/n/a): ".. question
  12. local answer
  13. repeat
  14. print(query)
  15. answer = io.read()
  16. until answer == "y" or answer == "n" or answer == "a"
  17. if answer == "y" then
  18. return "Yes"
  19. elseif answer == "n" then
  20. return "No"
  21. else
  22. return "Abstain"
  23. end
  24. end