12345678910111213141516171819202122232425 |
- -- ===================================================================
- -- /orgs.lua
- -- User interaction functions for Modular Politics
- -- Called by modpol.lua
- -- ===================================================================
- -- Function: modpol.binary_poll_user(user, question)
- -- Params: user (string), question (string)
- -- Output:
- -- presents a yes/no/abstain poll to a user, returns answer
- modpol.binary_poll_user = function(user, question)
- local query = "Poll for " .. user .. " (y/n/a): ".. question
- local answer
- repeat
- print(query)
- answer = io.read()
- until answer == "y" or answer == "n" or answer == "a"
- if answer == "y" then
- return "Yes"
- elseif answer == "n" then
- return "No"
- else
- return "Abstain"
- end
- end
|