-- =================================================================== -- /orgs.lua -- User interaction functions for Modular Politics -- Called by modpol.lua -- =================================================================== -- Function: modpol.menu(user) -- Params: user (string) -- Q: Should this return a menu of commands relevant to the specific user? -- Output: Displays a menu of commands to the user -- TKTK currently just prints all of modpol---needs major improvement modpol.menu = function(user) local output = "Command list:\n" for key,value in pairs(modpol) do output = output .. "- modpol." .. key .. "\n" end print(output) end -- =================================================================== -- 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