Added modpol.interactions.display and display_processes module, as well as a bunch of bugfixes

This commit is contained in:
Nathan Schneider
2021-12-29 22:07:53 -07:00
parent 6558b7a026
commit 7ef0626357
5 changed files with 149 additions and 34 deletions

View File

@ -168,6 +168,7 @@ function modpol.interactions.org_dashboard(user, org_string)
org:call_module(module_sel, user)
else
print("Error: Module not found.")
modpol.interactions.org_dashboard(user, org.id)
end
elseif sel == 'p' or sel == 'P' then
@ -261,18 +262,26 @@ end
--- Function: modpol.interactions.display
-- Displays complex data to a user
-- @param user Name of target user (string)
-- @param title Title of display (string)
-- @param message Content of message (string or table of strings)
-- @param done Optional function for what happens when user is done
function modpol.interactions.display(user, message, completion)
function modpol.interactions.display(user, title, message, completion)
local output = ""
if type(message) == table then
output = "\n-=< "..title.." >=-\n\n"
if type(message) == "table" then
output = table.concat(message,"\n")
elseif type(message) == string then
elseif type(message) == "string" then
output = message
elseif type(message) == number then
elseif type(message) == "number" then
output = message
else
return nil, "Error: message not typed for display"
modpol.interactions.message(
self.initiator, "Error: message not typed for display")
modpol.interactions.message(
self.initiator, "Error: input not typed for display")
if completion then completion() else
modpol.intereactions.dashboard(user)
end
end
print(message)
print("\nEnter to continue")