-- =================================================================== -- /orgs.lua -- User interaction functions for Modular Politics -- Called by modpol.lua -- =================================================================== -- Function: modpol.dashboard(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.dashboard = function(user) local output = "" -- Org status output = output .. "Orgs:\n" .. modpol.orgs.list_all() -- Process status (ongoing processes) output = output .. "Processes:\n" .. table.concat(modpol.processes) -- Command list (should be redone to be org-specific) output = output .. "Command list:\n" for key,value in pairs(modpol) do output = output .. "modpol." .. key .. " " 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