Module modpol.interactions
INTERACTIONS.LUA (CLI).
User interaction functions for Modular Politics Called by modpol.lua
Functions
Functions
- modpol.interactions.dashboard (user)
-
Output: Display a menu of commands to the user
Parameters:
- user (string)
- modpol.interactions.org_dashboard (user, org_string)
-
Output: Displays a menu of org-specific commands to the user
Parameters:
- user (string)
- org_string (string or id)
- modpol.interactions.user_dashboard (viewer, user, completion)
-
Function: modpol.interactions.user_dashboard
Displays a dashboard about a particular user
Parameters:
- viewer Name of user viewing the dashboard (string)
- user Name of user being viewed (string)
- completion Optional function to call on Done button
- modpol.interactions.message (user, message)
-
Prints message to CLI.
Buttons: message, done
Parameters:
- user (string)
- message (string)
- modpol.interactions.message_user (sender, recipient)
-
Gets and sends a message from one user to another
Parameters:
- sender Name of user sending (string)
- recipient Name of user receiving (string)
- modpol.interactions.display (user, title, message, done)
-
Displays complex data to a user
Parameters:
- user Name of target user (string)
- title Title of display (string)
- message Content of message (string or table of strings)
- done Optional function for what happens when user is done
- modpol.interactions.text_query (User, Query, func)
-
Applies "func" to user input.
Func input: user input (string)
Parameters:
- User (string)
- Query (string)
- func (function)
- modpol.interactions.dropdown_query (user, label, options, func)
-
Output: Calls func on choice.
Func input: choice (string)
Parameters:
- user (string)
- label (string)
- options (table of strings)
- func (choice) (function)
- modpol.interactions.checkbox_query (user, label, options, func)
-
Allows user to select from a set of options
Parameters:
- user Name of user (string)
- label Query for user before options (string)
- options Table of options and their checked status in the form {{"option_1_string", true}, {"option_2_string", false}}
- func Function to be called with param "input", made up of the corrected table in the same format as the param options
- modpol.interactions.binary_poll_user (user, question, func)
-
Output: Applies "func" to user input.
Func input: user input (string: y/n)
Parameters:
- user (string)
- question (string)
- func (function)
- modpol.interactions.message_org (initiator, org, message)
-
Output: broadcasts message to all org members
Parameters:
- initiator (string)
- org (number or string)
- message (string)