26 lines
773 B
Lua
26 lines
773 B
Lua
-- ===================================================================
|
|
-- /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
|