From 4052fa4b5589261cce6c35c41e615624ee79be58 Mon Sep 17 00:00:00 2001 From: SkylarHew Date: Sun, 9 Jan 2022 22:15:54 -0700 Subject: [PATCH 1/8] Ldoc comments for orgs.base and edited comments for template_module --- modpol_core/modules/template.lua | 12 ++-- modpol_core/orgs/base.lua | 96 +++++++++++++++++++------------- 2 files changed, 62 insertions(+), 46 deletions(-) diff --git a/modpol_core/modules/template.lua b/modpol_core/modules/template.lua index 1bbd03f..aeb1a04 100644 --- a/modpol_core/modules/template.lua +++ b/modpol_core/modules/template.lua @@ -1,11 +1,11 @@ ---- module_template +--- Template for module writers -- @module module_template ---- (Required): data table containing name and description of the module +--- (Required): Data table containing name and description of the module -- @field name "Human-readable name (parens OK, no brackets)" -- @field slug "Same as module class name" -- @field desc "Description of the module" --- @field hide "Whether this is a hidden utility module" +-- @field hide Whether this is a hidden utility module local module_template = { name = "Module Human-Readable Name", slug = "module_template", @@ -14,12 +14,12 @@ local module_template = { } --- (Required) Data for module --- Variables that module uses during the course of a process +-- Variables that module uses during the course of a process. -- Can be blank module_template.data = { } ---- (Required): config for module +--- (Required): Config for module -- Defines the input parameters to the module initiate function. -- Can be blank -- When calling a module from within another module, @@ -32,7 +32,7 @@ module_template.config = { field_2 = "majority" } ---- (Required): initiate function +--- (Required): Initiate function -- Modules have access to the following instance variables: --
  • self.org (the org the module was called in),
  • --
  • self.initiator (the user that callced the module),
  • diff --git a/modpol_core/orgs/base.lua b/modpol_core/orgs/base.lua index 850cce1..c3c0809 100644 --- a/modpol_core/orgs/base.lua +++ b/modpol_core/orgs/base.lua @@ -1,5 +1,5 @@ ---- Orgs: Base --- Basic functions for orgs +--- Basic function for orgs +-- @module modpol.orgs.base modpol.orgs = modpol.orgs or { @@ -23,8 +23,10 @@ function temp_org() } end --- ================================================== --- returns org when given its id or name +--- Return org when given its id or name +-- @function modpol.orgs.get_org +-- @param arg string for name of org or id of org +-- @return org specified by id or name function modpol.orgs.get_org(arg) if type(arg) == 'string' then for id, org in ipairs(modpol.orgs.array) do @@ -38,8 +40,9 @@ function modpol.orgs.get_org(arg) return nil end --- =============================================== --- returns a table list of all org names +--- Return a table list of all org names +-- @function modpol.orgs.list_all +-- @return a table list of all org names function modpol.orgs.list_all() local org_table for k, v in ipairs(modpol.orgs.array) do @@ -54,9 +57,10 @@ function modpol.orgs.list_all() return org_table end --- Function: modpol.orgs.user_orgs(user) --- input: user (string) --- output: table of strings of org names +--- Return the orgs of a user +-- @function modpol.orgs.user_orgs +-- @param user string of user name +-- @return table of strings of org names function modpol.orgs.user_orgs(user) local all_orgs = modpol.orgs.list_all() local user_orgs = {} @@ -69,8 +73,8 @@ function modpol.orgs.user_orgs(user) return user_orgs end --- =========================================== --- deletes all orgs except for the instance +--- Deletes all orgs except for the +-- @function modpol.orgs.reset function modpol.orgs.reset() for id, org in ipairs(modpol.orgs.array) do if id > 1 then @@ -86,9 +90,9 @@ function modpol.orgs.reset() modpol.orgs:record('Resetting all orgs', 'org_reset') end --- =================================================== --- initializes the instance (root org) +--- Initializes the instance (root org) -- can only be run once, as only one instance can exist +-- @function modpol.orgs.init_instance function modpol.orgs.init_instance() local error_msg if modpol.orgs.array[1] then @@ -114,8 +118,8 @@ end -- FUNCTIONS BEYOND HERE OPERATE ON ORG OBJECTS --- ======================================================= --- records a log message to the modpol ledger +--- Records a log message to the modpol ledger +-- @function modpol.orgs:record function modpol.orgs:record(msg, entry_type) local entry = { timestamp = '', @@ -148,10 +152,12 @@ function modpol.orgs:record(msg, entry_type) modpol.store_data() end --- ================================================== --- adds a new sub org to the org it is called on --- input: name (string), user (string) --- ex: instance:add_org('town hall') +--- Adds a new sub org to the org it is called on. +-- Ex: instance:add_org('town hall') +-- @function modpol.orgs:add_org +-- @param name (string) name of new org +-- @param user (string) +-- @return child org created function modpol.orgs:add_org(name, user) if self.id == nil then modpol.ocutil.log('Error in ' .. self.name .. ':add_org -> add_org can only be called by another org') @@ -194,10 +200,10 @@ function modpol.orgs:add_org(name, user) return child_org end --- ======================================== --- recursively deletes an org and its suborgs --- leaves entry in modpol.orgs.array as a string "removed" --- note: "reason" param was removed, can be added back +--- Recursively deletes an org and its suborgs +-- Leaves entry in modpol.orgs.array as a string "removed". +-- Note: "reason" param was removed, can be added back +-- @function modpol.orgs:delete function modpol.orgs:delete() if self.id == 1 then modpol.ocutil.log('Error in ' .. self.name .. ':delete -> cannot delete instance') @@ -219,9 +225,10 @@ function modpol.orgs:delete() end - --- =========================================== --- internal function to get the index of a member name +--- Internal function to get the index of a member name +-- @function modpol.orgs:get_member_index +-- @param member +-- @return index of given member function modpol.orgs:get_member_index(member) for k, v in ipairs(self.members) do if v == member then @@ -230,8 +237,9 @@ function modpol.orgs:get_member_index(member) end end --- =========================================== --- adds a user to an org +--- Adds a user to an org +-- @function modpol.orgs:add_member +-- @param user function modpol.orgs:add_member(user) for id, name in ipairs(self.members) do if user == name then @@ -253,8 +261,9 @@ function modpol.orgs:add_member(user) end --- ======================================= --- removes a user from an org +--- Removes a user from an org +-- @function modpol.orgs:remove_member +-- @param user function modpol.orgs:remove_member(user) -- sets the array index to an empty string so that consecutive list is preserved -- empty spots will get filled in by new members @@ -268,8 +277,10 @@ function modpol.orgs:remove_member(user) self:record('Removed member ' .. user, 'del_member') end --- =========================================== --- boolean check whether user is an org +--- Boolean check whether user is an org +-- @function modpol.orgs:has_member +-- @param user +-- @return true if user is in org, false if not function modpol.orgs:has_member(user) local user_index = self:get_member_index(user) if user_index then @@ -279,9 +290,9 @@ function modpol.orgs:has_member(user) end end --- ================================== --- Function: modpol.orgs:list_members() --- output: a table of the names (string) of members +--- +-- @function modpol.orgs:list_members() +-- @return a table of the names (string) of members function modpol.orgs:list_members() local members = {} for k, v in ipairs(self.members) do @@ -290,8 +301,9 @@ function modpol.orgs:list_members() return members end --- ============================== --- because member list uses lazy deletion, using #org.members will not show an accurate number +--- Because member list uses lazy deletion, using #org.members will not show an accurate number +-- @function modpol.orgs:get_member_count +-- @return numbers of members function modpol.orgs:get_member_count() local count = 0 for k, v in ipairs(self.members) do @@ -302,9 +314,13 @@ function modpol.orgs:get_member_count() end return count end --- ==================================== --- adds a new policy to the policy table --- must define the policy type, process associated with it, and whether the request must be made by an org member + +--- Adds a new policy to the policy table. +-- Must define the policy type, process associated with it, and whether the request must be made by an org member +-- @function modpol.orgs:set_policy +-- @param policy_type +-- @param process_type +-- @param must_be_member Boolean function modpol.orgs:set_policy(policy_type, process_type, must_be_member) local new_policy = { process_type = process_type, From 5085d87f68e1681388af4c89d8a46340551c04e0 Mon Sep 17 00:00:00 2001 From: SkylarHew Date: Mon, 10 Jan 2022 17:27:27 -0700 Subject: [PATCH 2/8] Added Ldoc comments for interactions and orgs.process.lua --- modpol_core/interactions/interactions.lua | 69 ++++++++++++++--------- modpol_core/orgs/process.lua | 30 ++++++++++ 2 files changed, 71 insertions(+), 28 deletions(-) diff --git a/modpol_core/interactions/interactions.lua b/modpol_core/interactions/interactions.lua index f3df03c..709b481 100644 --- a/modpol_core/interactions/interactions.lua +++ b/modpol_core/interactions/interactions.lua @@ -1,7 +1,7 @@ --- INTERACTIONS.LUA (CLI) - +--- INTERACTIONS.LUA (CLI). -- User interaction functions for Modular Politics -- Called by modpol.lua +-- @module modpol.interactions modpol.interactions = {} @@ -9,10 +9,11 @@ modpol.interactions = {} -- DASHBOARDS -- ========== --- Function: modpol.interactions.dashboard(user) --- Params: user (string) +--- Output: Display a menu of commands to the user +-- @function modpol.interactions.dashboard +-- @param 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 function modpol.interactions.dashboard(user) -- adds user to root org if not already in it @@ -59,10 +60,10 @@ function modpol.interactions.dashboard(user) end end - --- Function: modpol.interactions.org_dashboard --- Params: user (string), org_string (string or id) --- Output: Displays a menu of org-specific commands to the user +--- Output: Displays a menu of org-specific commands to the user +-- @function modpol.interactions.org_dashboard +-- @param user (string) +-- @param org_string (string or id) function modpol.interactions.org_dashboard(user, org_string) local org = modpol.orgs.get_org(org_string) if not org then return nil end @@ -169,28 +170,35 @@ end -- output: opens a dashboard for viewing/editing policy details -- TODO - --- Function: modpol.interactions.message --- input: user (string), message (string) --- output: prints message to CLI +--- Output: Prints message to CLI +-- @function modpol.interactions.message +-- @param user (string) +-- @param message (string) function modpol.interactions.message(user, message) print(user .. ": " .. message) end --- Function: modpol.interactions.text_query --- input: User (string), Query (string), func (function) --- func input: user input (string) --- output: Applies "func" to user input +--- Output: Applies "func" to user input. +-- Func input: user input (string) +-- @function modpol.interactions.text_query +-- @param user (string) +-- @param query (string) +-- @param func (function) function modpol.interactions.text_query(user, query, func) print(user .. ": " .. query) answer = io.read() func(answer) end --- Function: dropdown_query --- input: user (string), label (string), options (table of strings), func(choice) (function) --- func input: choice (string) --- output: calls func on choice +--- Output: Calls func on choice. +-- func input: choice (string) +-- @function modpol.interactions.dropdown_query +-- @param user (string) +-- @param label (string) +-- @param options (table of strings) +-- @param func (choice) (function) + + function modpol.interactions.dropdown_query(user, label, options, func) -- set up options local options_display = "" @@ -226,10 +234,12 @@ function modpol.interactions.dropdown_query(user, label, options, func) end end --- Function: modpol.binary_poll_user(user, question) --- Params: user (string), question (string), func (function) --- func input: user input (string: y/n) --- Output: Applies "func" to user input +--- Output: Applies "func" to user input. +-- Func input: user input (string: y/n) +-- @function modpol.binary_poll_user(user, question) +-- @param user (string) +-- @param question (string) +-- @param func (function) function modpol.interactions.binary_poll_user(user, question, func) local query = "Poll for " .. user .. " (y/n): ".. question local answer @@ -251,9 +261,12 @@ end -- COMPLEX INTERACTIONS -- ==================== --- Function: modpol.interactions.message_org --- input: initiator (string), org (number or string), message (string) --- output: broadcasts message to all org members +--- Output: broadcasts message to all org members +-- @function modpol.interactions.message_org +-- @param initiator (string) +-- @param org (number or string) +-- @param message (string) + function modpol.interactions.message_org(initiator, org, message) local this_org = modpol.orgs.get_org(org) local users = this_org:list_members() diff --git a/modpol_core/orgs/process.lua b/modpol_core/orgs/process.lua index 8961a1a..b49cb2e 100644 --- a/modpol_core/orgs/process.lua +++ b/modpol_core/orgs/process.lua @@ -1,5 +1,12 @@ --- Process functions for orgs +-- @module modpol.orgs.process +--- Call modules +-- @function modpol.orgs.call_module +-- @param module_slug Same as module name +-- @param intiator Initiator for module +-- @param config Config for module +-- @param result function modpol.orgs:call_module(module_slug, initiator, config, result) if not modpol.modules[module_slug] then modpol.ocutil.log('Error in ' .. self.name .. ':call_module -> module "' .. module_slug .. '" not found') @@ -53,10 +60,18 @@ function modpol.orgs:call_module(module_slug, initiator, config, result) return index end +--- Delete process by id +-- @function modpol.orgs:delete_process +-- @param id Id of process function modpol.orgs:delete_process(id) self.processes[id] = 'deleted' end +--- Add a new pending action +-- @function modpol.orgs:add_pending_action +-- @param process_id Process id +-- @param user User adding the action +-- @param callback function modpol.orgs:add_pending_action(process_id, user, callback) self.pending[user] = self.pending[user] or {} self.pending[user][process_id] = callback @@ -64,18 +79,29 @@ function modpol.orgs:add_pending_action(process_id, user, callback) user, "New pending action in org "..self.name) end +--- Remove a pending action +-- @function modpol.orgs:remove_pending_action +-- @param process_id Process id to be removed +-- @param user function modpol.orgs:remove_pending_action(process_id, user) if self.pending[user] then self.pending[user][process_id] = nil end end +--- Wipe all pending actions for process +-- @function modpol.orgs:wipe_pending_actions +-- @param process_id function modpol.orgs:wipe_pending_actions(process_id) for user in pairs(self.pending) do self.pending[user][process_id] = nil end end +--- Check if there are pending actions for user +-- @function modpol.orgs:has_pending_actions +-- @param user User +-- @return True if there are pending actions for a user, false if not function modpol.orgs:has_pending_actions(user) -- next() will return the next pair in a table -- if next() returns nil, the table is empty @@ -90,6 +116,10 @@ function modpol.orgs:has_pending_actions(user) end end +--- Interact a user with given process +-- @function modpol.orgs:interact +-- @param process_id +-- @param user function modpol.orgs:interact(process_id, user) local process = self.processes[process_id] if self.pending[user] then From da7b996a8b04ea3f8de993ac8eedee7ccb08311c Mon Sep 17 00:00:00 2001 From: SkylarHew Date: Thu, 20 Jan 2022 11:04:44 -0700 Subject: [PATCH 3/8] Added ldoc comments for all lua modules and generated docs in documentation index.html --- documentation/config.ld | 2 + documentation/doc/index.html | 164 ++++++ documentation/doc/ldoc.css | 303 +++++++++++ .../doc/modules/add_child_org_consent.html | 144 ++++++ documentation/doc/modules/change_modules.html | 148 ++++++ documentation/doc/modules/consent.html | 149 ++++++ documentation/doc/modules/join_org.html | 125 +++++ .../doc/modules/join_org_consent.html | 145 ++++++ .../doc/modules/join_org_consent.lua.html | 145 ++++++ documentation/doc/modules/leave_org.html | 125 +++++ documentation/doc/modules/message_org.html | 125 +++++ .../doc/modules/modpol.interactions.html | 307 +++++++++++ .../doc/modules/modpol.orgs.base.html | 475 ++++++++++++++++++ .../doc/modules/modpol.orgs.process.html | 295 +++++++++++ .../doc/modules/modpol.util.misc.html | 159 ++++++ .../modpol_core.modules.join_org_consent.html | 145 ++++++ ...odpol_core.modules.remove_org_consent.html | 127 +++++ .../doc/modules/modpol_minetest.api.html | 90 ++++ .../doc/modules/module_template.html | 221 ++++++++ documentation/doc/modules/priv_to_org.html | 125 +++++ .../doc/modules/remove_child_consent.html | 127 +++++ .../doc/modules/remove_member_consent.html | 124 +++++ documentation/doc/modules/remove_org.html | 125 +++++ .../doc/modules/remove_org_consent.html | 127 +++++ .../doc/modules/rename_org_consent.html | 145 ++++++ documentation/headers_template.html | 63 +++ modpol_core/modules/add_child_org_consent.lua | 11 +- modpol_core/modules/change_modules.lua | 6 +- modpol_core/modules/consent.lua | 10 +- modpol_core/modules/join_org.lua | 5 + modpol_core/modules/join_org_consent.lua | 8 +- modpol_core/modules/leave_org.lua | 10 +- modpol_core/modules/message_org.lua | 5 +- modpol_core/modules/remove_child_consent.lua | 4 + modpol_core/modules/remove_member_consent.lua | 6 +- modpol_core/modules/remove_org.lua | 11 +- modpol_core/modules/remove_org_consent.lua | 4 + modpol_core/modules/rename_org_consent.lua | 6 + modpol_core/modules/template.lua | 2 +- modpol_core/util/misc.lua | 15 +- modpol_minetest/modules/priv_to_org.lua | 9 +- 41 files changed, 4307 insertions(+), 35 deletions(-) create mode 100644 documentation/config.ld create mode 100644 documentation/doc/index.html create mode 100644 documentation/doc/ldoc.css create mode 100644 documentation/doc/modules/add_child_org_consent.html create mode 100644 documentation/doc/modules/change_modules.html create mode 100644 documentation/doc/modules/consent.html create mode 100644 documentation/doc/modules/join_org.html create mode 100644 documentation/doc/modules/join_org_consent.html create mode 100644 documentation/doc/modules/join_org_consent.lua.html create mode 100644 documentation/doc/modules/leave_org.html create mode 100644 documentation/doc/modules/message_org.html create mode 100644 documentation/doc/modules/modpol.interactions.html create mode 100644 documentation/doc/modules/modpol.orgs.base.html create mode 100644 documentation/doc/modules/modpol.orgs.process.html create mode 100644 documentation/doc/modules/modpol.util.misc.html create mode 100644 documentation/doc/modules/modpol_core.modules.join_org_consent.html create mode 100644 documentation/doc/modules/modpol_core.modules.remove_org_consent.html create mode 100644 documentation/doc/modules/modpol_minetest.api.html create mode 100644 documentation/doc/modules/module_template.html create mode 100644 documentation/doc/modules/priv_to_org.html create mode 100644 documentation/doc/modules/remove_child_consent.html create mode 100644 documentation/doc/modules/remove_member_consent.html create mode 100644 documentation/doc/modules/remove_org.html create mode 100644 documentation/doc/modules/remove_org_consent.html create mode 100644 documentation/doc/modules/rename_org_consent.html create mode 100644 documentation/headers_template.html diff --git a/documentation/config.ld b/documentation/config.ld new file mode 100644 index 0000000..2a91e26 --- /dev/null +++ b/documentation/config.ld @@ -0,0 +1,2 @@ +project = 'modpol' +description = 'modpol core' \ No newline at end of file diff --git a/documentation/doc/index.html b/documentation/doc/index.html new file mode 100644 index 0000000..ee3531b --- /dev/null +++ b/documentation/doc/index.html @@ -0,0 +1,164 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + + +

    modpol core

    + +

    Modules

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    modpol.interactionsINTERACTIONS.LUA (CLI).
    add_child_org_consentAdds a child org.
    change_moduleschange_modules + Depends on consent
    consentA utility module for checking consent
    join_orgAdds a user to org
    join_org_consentJoin org (consent).
    leave_orgRemoves initiator from org
    message_orgMessages all org members
    remove_child_consentRemove child (consent) + A simple module that calls a consent process on an org to remove its child + Depends on the Consent module.
    remove_member_consentCalls consent to remove member from org
    remove_orgA simple module that removes an org.
    remove_org_consentRemove org (consent) + A simple module that calls a consent process on an org to remove it.
    rename_org_consentRename org (consent) + A simple module that calls a consent process on an org to rename it.
    module_templateTemplate for module writers
    modpol.orgs.baseBasic function for orgs
    modpol.orgs.processProcess functions for orgs
    modpol.util.miscMiscellaneous functions
    modpol_minetest.apiScript for loading Minetest files
    priv_to_orgSet privilege to org members + Allows initiator to grant a priv they have to all members of an org
    + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/ldoc.css b/documentation/doc/ldoc.css new file mode 100644 index 0000000..52c4ad2 --- /dev/null +++ b/documentation/doc/ldoc.css @@ -0,0 +1,303 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 20px 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid #C0C0C0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation { + float: left; + width: 14em; + vertical-align: top; + background-color: #f0f0f0; + overflow: visible; +} + +#navigation h2 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + width: 700px; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.module_list td.summary { width: 100%; } + + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +ul.nowrap { + overflow:auto; + white-space:nowrap; +} + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .user-keyword { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } + diff --git a/documentation/doc/modules/add_child_org_consent.html b/documentation/doc/modules/add_child_org_consent.html new file mode 100644 index 0000000..52ba72f --- /dev/null +++ b/documentation/doc/modules/add_child_org_consent.html @@ -0,0 +1,144 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module add_child_org_consent

    +

    Adds a child org.

    +

    + Depends on `consent`

    + + +

    Functions

    + + + + + + + + + +
    initiate (result)Initiate consent for new child org
    create_child_org ()Create a new child orgg
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate consent for new child org + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + create_child_org () +
    +
    + Create a new child orgg + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/change_modules.html b/documentation/doc/modules/change_modules.html new file mode 100644 index 0000000..4e043de --- /dev/null +++ b/documentation/doc/modules/change_modules.html @@ -0,0 +1,148 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module change_modules

    +

    change_modules + Depends on consent

    +

    + + +

    Functions

    + + + + + + + + + +
    initiate ()Initiate change in modules.
    propose_change (type, mod_text)propose_change
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate () +
    +
    + Initiate change in modules. + Either adds or removes module depending on user input + + + + + + + +
    +
    + + propose_change (type, mod_text) +
    +
    + propose_change + + +

    Parameters:

    +
      +
    • type + +
    • +
    • mod_text + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/consent.html b/documentation/doc/modules/consent.html new file mode 100644 index 0000000..88c1c28 --- /dev/null +++ b/documentation/doc/modules/consent.html @@ -0,0 +1,149 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module consent

    +

    A utility module for checking consent

    +

    + + +

    Functions

    + + + + + + + + + +
    initiate (result)Initiate consent
    callback (member)Callback
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + callback (member) +
    +
    + Callback + + +

    Parameters:

    +
      +
    • member + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/join_org.html b/documentation/doc/modules/join_org.html new file mode 100644 index 0000000..bc279e9 --- /dev/null +++ b/documentation/doc/modules/join_org.html @@ -0,0 +1,125 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module join_org

    +

    Adds a user to org

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Adds the user to the org
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Adds the user to the org + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/join_org_consent.html b/documentation/doc/modules/join_org_consent.html new file mode 100644 index 0000000..9e2bbc4 --- /dev/null +++ b/documentation/doc/modules/join_org_consent.html @@ -0,0 +1,145 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module join_org_consent

    +

    Join org (consent).

    +

    + A simple module that calls a consent process on an org to add a member. + Depends on the Consent module.

    + + +

    Functions

    + + + + + + + + + +
    initiate (result)Initiate join org with consent
    complete ()Adds member to org, notifies org, and deletes process
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate join org with consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + complete () +
    +
    + Adds member to org, notifies org, and deletes process + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/join_org_consent.lua.html b/documentation/doc/modules/join_org_consent.lua.html new file mode 100644 index 0000000..2949a4b --- /dev/null +++ b/documentation/doc/modules/join_org_consent.lua.html @@ -0,0 +1,145 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module join_org_consent.lua

    +

    Join org (consent).

    +

    + A simple module that calls a consent process on an org to add a member. + Depends on the Consent module.

    + + +

    Functions

    + + + + + + + + + +
    join_org_consent:initiate (result)Initiate join org with consent
    join_org_consent:complete ()Adds member to org, notifies org, and deletes process
    + +
    +
    + + +

    Functions

    + +
    +
    + + join_org_consent:initiate (result) +
    +
    + Initiate join org with consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + join_org_consent:complete () +
    +
    + Adds member to org, notifies org, and deletes process + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:46:26 +
    +
    + + diff --git a/documentation/doc/modules/leave_org.html b/documentation/doc/modules/leave_org.html new file mode 100644 index 0000000..760f967 --- /dev/null +++ b/documentation/doc/modules/leave_org.html @@ -0,0 +1,125 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module leave_org

    +

    Removes initiator from org

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Removes user from org
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Removes user from org + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/message_org.html b/documentation/doc/modules/message_org.html new file mode 100644 index 0000000..e34e38d --- /dev/null +++ b/documentation/doc/modules/message_org.html @@ -0,0 +1,125 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module message_org

    +

    Messages all org members

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Allows user to send input message to all org members
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Allows user to send input message to all org members + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/modpol.interactions.html b/documentation/doc/modules/modpol.interactions.html new file mode 100644 index 0000000..6c28f6c --- /dev/null +++ b/documentation/doc/modules/modpol.interactions.html @@ -0,0 +1,307 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol.interactions

    +

    INTERACTIONS.LUA (CLI).

    +

    + User interaction functions for Modular Politics + Called by modpol.lua

    + + +

    Functions

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    modpol.interactions.dashboard (user)Output: Display a menu of commands to the user
    modpol.interactions.org_dashboard (user, org_string)Output: Displays a menu of org-specific commands to the user
    modpol.interactions.message (user, message)Output: Prints message to CLI
    modpol.interactions.text_query (user, query, func)Output: Applies "func" to user input.
    modpol.interactions.dropdown_query (user, label, options, func)Output: Calls func on choice.
    modpol.binary_poll_user (user, question, func)Output: Applies "func" to user input.
    modpol.interactions.message_org (initiator, org, message)Output: broadcasts message to all org members
    + +
    +
    + + +

    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.message (user, message) +
    +
    + Output: Prints message to CLI + + +

    Parameters:

    +
      +
    • user + (string) +
    • +
    • message + (string) +
    • +
    + + + + + +
    +
    + + modpol.interactions.text_query (user, query, func) +
    +
    + Output: 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.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) +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/modpol.orgs.base.html b/documentation/doc/modules/modpol.orgs.base.html new file mode 100644 index 0000000..bb3c10a --- /dev/null +++ b/documentation/doc/modules/modpol.orgs.base.html @@ -0,0 +1,475 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol.orgs.base

    +

    Basic function for orgs

    +

    + + +

    Functions

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    modpol.orgs.get_org (arg)Return org when given its id or name
    modpol.orgs.list_all ()Return a table list of all org names
    modpol.orgs.user_orgs (user)Return the orgs of a user
    modpol.orgs.reset ()Deletes all orgs except for the
    modpol.orgs.init_instance ()Initializes the instance (root org) + can only be run once, as only one instance can exist
    modpol.orgs:record ()Records a log message to the modpol ledger
    modpol.orgs:add_org (name, user)Adds a new sub org to the org it is called on.
    modpol.orgs:delete ()Recursively deletes an org and its suborgs + Leaves entry in modpol.orgs.array as a string "removed".
    modpol.orgs:get_member_index (member)Internal function to get the index of a member name
    modpol.orgs:add_member (user)Adds a user to an org
    modpol.orgs:remove_member (user)Removes a user from an org
    modpol.orgs:has_member (user)Boolean check whether user is an org
    modpol.orgs:list_members ()
    modpol.orgs:get_member_count ()Because member list uses lazy deletion, using #org.members will not show an accurate number
    modpol.orgs:set_policy (policy_type, process_type, must_be_member)Adds a new policy to the policy table.
    + +
    +
    + + +

    Functions

    + +
    +
    + + modpol.orgs.get_org (arg) +
    +
    + Return org when given its id or name + + +

    Parameters:

    +
      +
    • arg + string for name of org or id of org +
    • +
    + +

    Returns:

    +
      + + org specified by id or name +
    + + + + +
    +
    + + modpol.orgs.list_all () +
    +
    + Return a table list of all org names + + + +

    Returns:

    +
      + + a table list of all org names +
    + + + + +
    +
    + + modpol.orgs.user_orgs (user) +
    +
    + Return the orgs of a user + + +

    Parameters:

    +
      +
    • user + string of user name +
    • +
    + +

    Returns:

    +
      + + table of strings of org names +
    + + + + +
    +
    + + modpol.orgs.reset () +
    +
    + Deletes all orgs except for the + + + + + + + +
    +
    + + modpol.orgs.init_instance () +
    +
    + Initializes the instance (root org) + can only be run once, as only one instance can exist + + + + + + + +
    +
    + + modpol.orgs:record () +
    +
    + Records a log message to the modpol ledger + + + + + + + +
    +
    + + modpol.orgs:add_org (name, user) +
    +
    + Adds a new sub org to the org it is called on. + Ex: instance:add_org('town hall') + + +

    Parameters:

    +
      +
    • name + (string) name of new org +
    • +
    • user + (string) +
    • +
    + +

    Returns:

    +
      + + child org created +
    + + + + +
    +
    + + modpol.orgs:delete () +
    +
    + Recursively deletes an org and its suborgs + Leaves entry in modpol.orgs.array as a string "removed". + Note: "reason" param was removed, can be added back + + + + + + + +
    +
    + + modpol.orgs:get_member_index (member) +
    +
    + Internal function to get the index of a member name + + +

    Parameters:

    +
      +
    • member + +
    • +
    + +

    Returns:

    +
      + + index of given member +
    + + + + +
    +
    + + modpol.orgs:add_member (user) +
    +
    + Adds a user to an org + + +

    Parameters:

    +
      +
    • user + +
    • +
    + + + + + +
    +
    + + modpol.orgs:remove_member (user) +
    +
    + Removes a user from an org + + +

    Parameters:

    +
      +
    • user + +
    • +
    + + + + + +
    +
    + + modpol.orgs:has_member (user) +
    +
    + Boolean check whether user is an org + + +

    Parameters:

    +
      +
    • user + +
    • +
    + +

    Returns:

    +
      + + true if user is in org, false if not +
    + + + + +
    +
    + + modpol.orgs:list_members () +
    +
    + + + + +

    Returns:

    +
      + + a table of the names (string) of members +
    + + + + +
    +
    + + modpol.orgs:get_member_count () +
    +
    + Because member list uses lazy deletion, using #org.members will not show an accurate number + + + +

    Returns:

    +
      + + numbers of members +
    + + + + +
    +
    + + modpol.orgs:set_policy (policy_type, process_type, must_be_member) +
    +
    + Adds a new policy to the policy table. + Must define the policy type, process associated with it, and whether the request must be made by an org member + + +

    Parameters:

    +
      +
    • policy_type + +
    • +
    • process_type + +
    • +
    • must_be_member + Boolean +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/modpol.orgs.process.html b/documentation/doc/modules/modpol.orgs.process.html new file mode 100644 index 0000000..cd7fe4d --- /dev/null +++ b/documentation/doc/modules/modpol.orgs.process.html @@ -0,0 +1,295 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol.orgs.process

    +

    Process functions for orgs

    +

    + + +

    Functions

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    modpol.orgs.call_module (module_slug, intiator, config, result)Call modules
    modpol.orgs:delete_process (id)Delete process by id
    modpol.orgs:add_pending_action (process_id, user, callback)Add a new pending action
    modpol.orgs:remove_pending_action (process_id, user)Remove a pending action
    modpol.orgs:wipe_pending_actions (process_id)Wipe all pending actions for process
    modpol.orgs:has_pending_actions (user)Check if there are pending actions for user
    modpol.orgs:interact (process_id, user)Interact a user with given process
    + +
    +
    + + +

    Functions

    + +
    +
    + + modpol.orgs.call_module (module_slug, intiator, config, result) +
    +
    + Call modules + + +

    Parameters:

    +
      +
    • module_slug + Same as module name +
    • +
    • intiator + Initiator for module +
    • +
    • config + Config for module +
    • +
    • result + +
    • +
    + + + + + +
    +
    + + modpol.orgs:delete_process (id) +
    +
    + Delete process by id + + +

    Parameters:

    +
      +
    • id + Id of process +
    • +
    + + + + + +
    +
    + + modpol.orgs:add_pending_action (process_id, user, callback) +
    +
    + Add a new pending action + + +

    Parameters:

    +
      +
    • process_id + Process id +
    • +
    • user + User adding the action +
    • +
    • callback + +
    • +
    + + + + + +
    +
    + + modpol.orgs:remove_pending_action (process_id, user) +
    +
    + Remove a pending action + + +

    Parameters:

    +
      +
    • process_id + Process id to be removed +
    • +
    • user + +
    • +
    + + + + + +
    +
    + + modpol.orgs:wipe_pending_actions (process_id) +
    +
    + Wipe all pending actions for process + + +

    Parameters:

    +
      +
    • process_id + +
    • +
    + + + + + +
    +
    + + modpol.orgs:has_pending_actions (user) +
    +
    + Check if there are pending actions for user + + +

    Parameters:

    +
      +
    • user + User +
    • +
    + +

    Returns:

    +
      + + True if there are pending actions for a user, false if not +
    + + + + +
    +
    + + modpol.orgs:interact (process_id, user) +
    +
    + Interact a user with given process + + +

    Parameters:

    +
      +
    • process_id + +
    • +
    • user + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/modpol.util.misc.html b/documentation/doc/modules/modpol.util.misc.html new file mode 100644 index 0000000..a797dd2 --- /dev/null +++ b/documentation/doc/modules/modpol.util.misc.html @@ -0,0 +1,159 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol.util.misc

    +

    Miscellaneous functions

    +

    + + +

    Functions

    + + + + + + + + + +
    modpol.util.copy_table (t)Returns a copy of the table inputted
    modpol.util.num_pairs (t)Returns the number of elements in a pairs table
    + +
    +
    + + +

    Functions

    + +
    +
    + + modpol.util.copy_table (t) +
    +
    + Returns a copy of the table inputted + + +

    Parameters:

    +
      +
    • t + table to copy +
    • +
    + +

    Returns:

    +
      + + copy of table +
    + + + + +
    +
    + + modpol.util.num_pairs (t) +
    +
    + Returns the number of elements in a pairs table + + +

    Parameters:

    +
      +
    • t + pairs table +
    • +
    + +

    Returns:

    +
      + + number of elements in pairs table +
    + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/modpol_core.modules.join_org_consent.html b/documentation/doc/modules/modpol_core.modules.join_org_consent.html new file mode 100644 index 0000000..89dad99 --- /dev/null +++ b/documentation/doc/modules/modpol_core.modules.join_org_consent.html @@ -0,0 +1,145 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol_core.modules.join_org_consent

    +

    Join org (consent).

    +

    + A simple module that calls a consent process on an org to add a member. + Depends on the Consent module.

    + + +

    Functions

    + + + + + + + + + +
    initiate (result)Initiate join org with consent
    complete ()Adds member to org, notifies org, and deletes process
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate join org with consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + complete () +
    +
    + Adds member to org, notifies org, and deletes process + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:46:04 +
    +
    + + diff --git a/documentation/doc/modules/modpol_core.modules.remove_org_consent.html b/documentation/doc/modules/modpol_core.modules.remove_org_consent.html new file mode 100644 index 0000000..a8108e6 --- /dev/null +++ b/documentation/doc/modules/modpol_core.modules.remove_org_consent.html @@ -0,0 +1,127 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol_core.modules.remove_org_consent

    +

    Remove org (consent) + A simple module that calls a consent process on an org to remove it.

    +

    + Depends on the Consent module.

    + + +

    Functions

    + + + + + +
    initiate (result)Remove org if all members consent
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Remove org if all members consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:30:14 +
    +
    + + diff --git a/documentation/doc/modules/modpol_minetest.api.html b/documentation/doc/modules/modpol_minetest.api.html new file mode 100644 index 0000000..890d608 --- /dev/null +++ b/documentation/doc/modules/modpol_minetest.api.html @@ -0,0 +1,90 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module modpol_minetest.api

    +

    Script for loading Minetest files

    +

    + + + +
    +
    + + + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/module_template.html b/documentation/doc/modules/module_template.html new file mode 100644 index 0000000..5f53537 --- /dev/null +++ b/documentation/doc/modules/module_template.html @@ -0,0 +1,221 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module module_template

    +

    Template for module writers

    +

    + + +

    Functions

    + + + + + +
    initiate (result)(Required): Initiate function + Modules have access to the following instance variables: +
  • self.org (the org the module was called in),
  • +
  • self.initiator (the user that callced the module),
  • +
  • self.id (the process id of the module instance)
  • +

    Tables

    + + + + + + + + + +
    data(Required) Data for module + Variables that module uses during the course of a process.
    config(Required): Config for module + Defines the input parameters to the module initiate function.
    +

    Fields

    + + + + + +
    modpol.modules.module_template(Required) Add to module table
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + (Required): Initiate function + Modules have access to the following instance variables: +
  • self.org (the org the module was called in),
  • +
  • self.initiator (the user that callced the module),
  • +
  • self.id (the process id of the module instance)
  • + + +

    Parameters:

    +
      +
    • result + (optional) Callback if this module is embedded in other modules +
    • +
    + + + + + +
    +
    +

    Tables

    + +
    +
    + + data +
    +
    + (Required) Data for module + Variables that module uses during the course of a process. + Can be blank + + + + + + + +
    +
    + + config +
    +
    + (Required): Config for module + Defines the input parameters to the module initiate function. + Can be blank + When calling a module from within another module, + variables not defined in config will be ignored. + Default values set in config can be overridden + + +

    Fields:

    +
      +
    • field_1 + ex: votes_required, default = 5 +
    • +
    • field_2 + ex: voting_type, default = "majority" +
    • +
    + + + + + +
    +
    +

    Fields

    + +
    +
    + + modpol.modules.module_template +
    +
    + (Required) Add to module table + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/priv_to_org.html b/documentation/doc/modules/priv_to_org.html new file mode 100644 index 0000000..1d7e66d --- /dev/null +++ b/documentation/doc/modules/priv_to_org.html @@ -0,0 +1,125 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module priv_to_org

    +

    Set privilege to org members + Allows initiator to grant a priv they have to all members of an org

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Initiate function
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate function + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/remove_child_consent.html b/documentation/doc/modules/remove_child_consent.html new file mode 100644 index 0000000..cc003f3 --- /dev/null +++ b/documentation/doc/modules/remove_child_consent.html @@ -0,0 +1,127 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module remove_child_consent

    +

    Remove child (consent) + A simple module that calls a consent process on an org to remove its child + Depends on the Consent module.

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Removes a child org with consent
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Removes a child org with consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/remove_member_consent.html b/documentation/doc/modules/remove_member_consent.html new file mode 100644 index 0000000..afc2639 --- /dev/null +++ b/documentation/doc/modules/remove_member_consent.html @@ -0,0 +1,124 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module remove_member_consent

    +

    Calls consent to remove member from org

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Removes given member from org
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Removes given member from org + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/remove_org.html b/documentation/doc/modules/remove_org.html new file mode 100644 index 0000000..88c8ee8 --- /dev/null +++ b/documentation/doc/modules/remove_org.html @@ -0,0 +1,125 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module remove_org

    +

    A simple module that removes an org.

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Removes org
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Removes org + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/remove_org_consent.html b/documentation/doc/modules/remove_org_consent.html new file mode 100644 index 0000000..d409d74 --- /dev/null +++ b/documentation/doc/modules/remove_org_consent.html @@ -0,0 +1,127 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module remove_org_consent

    +

    Remove org (consent) + A simple module that calls a consent process on an org to remove it.

    +

    + Depends on the Consent module.

    + + +

    Functions

    + + + + + +
    initiate (result)Remove org if all members consent
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Remove org if all members consent + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/doc/modules/rename_org_consent.html b/documentation/doc/modules/rename_org_consent.html new file mode 100644 index 0000000..29abba5 --- /dev/null +++ b/documentation/doc/modules/rename_org_consent.html @@ -0,0 +1,145 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module rename_org_consent

    +

    Rename org (consent) + A simple module that calls a consent process on an org to rename it.

    +

    + Depends on the Consent module.

    + + +

    Functions

    + + + + + + + + + +
    initiate (result)Renames the org after consent is reached
    complete ()Changes the name of the org after consent is reached
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Renames the org after consent is reached + + +

    Parameters:

    +
      +
    • result + +
    • +
    + + + + + +
    +
    + + complete () +
    +
    + Changes the name of the org after consent is reached + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-20 10:54:01 +
    +
    + + diff --git a/documentation/headers_template.html b/documentation/headers_template.html new file mode 100644 index 0000000..ce66f4a --- /dev/null +++ b/documentation/headers_template.html @@ -0,0 +1,63 @@ +

    Basic Functions

    + + +

    Core Modules

    + + +

    Minetest Modules

    + + + + +

    Basic Functions

    + + +

    Core Modules

    + + +

    Minetest Modules

    + \ No newline at end of file diff --git a/modpol_core/modules/add_child_org_consent.lua b/modpol_core/modules/add_child_org_consent.lua index e323e19..1c74729 100644 --- a/modpol_core/modules/add_child_org_consent.lua +++ b/modpol_core/modules/add_child_org_consent.lua @@ -1,6 +1,6 @@ ---- @module add_child_org_consent --- Adds a child org +--- Adds a child org. -- Depends on `consent` +-- @module add_child_org_consent local add_child_org_consent = { name = "Add child org (consent)", @@ -14,7 +14,9 @@ add_child_org_consent.data = { add_child_org_consent.config = { } --- @function initiate +--- Initiate consent for new child org +-- @function add_child_org_consent:initiate(result) +-- @param result function add_child_org_consent:initiate(result) modpol.interactions.text_query( self.initiator,"Child org name: ", @@ -61,6 +63,8 @@ function add_child_org_consent:initiate(result) ) end +--- Create a new child orgg +-- @function add_child_org_consent:create_child_org function add_child_org_consent:create_child_org() self.org:add_org(self.data.child_name, self.initiator) modpol.interactions.message_org( @@ -71,5 +75,4 @@ function add_child_org_consent:create_child_org() self.org:delete_process(self.id) end ---- (Required) Add to module table modpol.modules.add_child_org_consent = add_child_org_consent diff --git a/modpol_core/modules/change_modules.lua b/modpol_core/modules/change_modules.lua index 7b15417..7457ed5 100644 --- a/modpol_core/modules/change_modules.lua +++ b/modpol_core/modules/change_modules.lua @@ -1,6 +1,6 @@ --- change_modules --- @module change_modules -- Depends on consent +-- @module change_modules local change_modules = { name = "Change modules (consent)", @@ -16,6 +16,9 @@ change_modules.data = { change_modules.config = { } +--- Initiate change in modules. +-- Either adds or removes module depending on user input +-- @function change_modules:initiate function change_modules:initiate(result) self.data.result = result -- Step 1: add or remove? @@ -167,5 +170,4 @@ function change_modules:propose_change(type, mod_text) self.org:delete_process(self.id) end ---- (Required) Add to module table modpol.modules.change_modules = change_modules diff --git a/modpol_core/modules/consent.lua b/modpol_core/modules/consent.lua index 78deca1..cf1ec4c 100644 --- a/modpol_core/modules/consent.lua +++ b/modpol_core/modules/consent.lua @@ -1,5 +1,5 @@ ---- @module consent --- A utility module for checking consent +--- A utility module for checking consent +-- @module consent local consent = { name = "Consent process utility", @@ -17,6 +17,9 @@ consent.config = { votes_required = 1 } +--- Initiate consent +-- @function consent:initiate +-- @param result function consent:initiate(result) self.data.result = result -- if org is empty, consent is given automatically @@ -32,6 +35,9 @@ function consent:initiate(result) end end +--- Callback +-- @function consent:callback +-- @param member function consent:callback(member) modpol.interactions.binary_poll_user( member, diff --git a/modpol_core/modules/join_org.lua b/modpol_core/modules/join_org.lua index 23d277b..8405ac6 100644 --- a/modpol_core/modules/join_org.lua +++ b/modpol_core/modules/join_org.lua @@ -1,3 +1,5 @@ +--- Adds a user to org +-- @module join_org join_org = {} @@ -7,6 +9,9 @@ join_org.setup = { desc = "If consent process is passed, initiator joins this org." } +--- Adds the user to the org +-- @function join_org.initiate +-- @param result function join_org.initiate(result) modpol.interactions.binary_poll_user( initiator, diff --git a/modpol_core/modules/join_org_consent.lua b/modpol_core/modules/join_org_consent.lua index 9bfa437..14c886b 100644 --- a/modpol_core/modules/join_org_consent.lua +++ b/modpol_core/modules/join_org_consent.lua @@ -1,6 +1,7 @@ ---- Join org (consent) +--- Join org (consent). -- A simple module that calls a consent process on an org to add a member. -- Depends on the Consent module. +-- @module join_org_consent local join_org_consent = { name = "Join this org (consent)", @@ -15,6 +16,9 @@ join_org_consent.data = { join_org_consent.config = { } +--- Initiate join org with consent +-- @function join_org_consent:initiate +-- @param result function join_org_consent:initiate(result) if self.org:has_member(self.initiator) then modpol.interactions.message( @@ -38,6 +42,8 @@ function join_org_consent:initiate(result) end end +--- Adds member to org, notifies org, and deletes process +-- @function join_org_consent:complete function join_org_consent:complete() self.org:add_member(self.initiator) modpol.interactions.message_org( diff --git a/modpol_core/modules/leave_org.lua b/modpol_core/modules/leave_org.lua index d8e685d..2ba71ee 100644 --- a/modpol_core/modules/leave_org.lua +++ b/modpol_core/modules/leave_org.lua @@ -1,4 +1,4 @@ ---- leave_org +--- Removes initiator from org -- @module leave_org local leave_org = { @@ -13,10 +13,9 @@ leave_org.data = { leave_org.config = { } ---- (Required): initiate function --- Modules have access to the following instance variables: --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- Removes user from org +-- @function leave_org:initiate +-- @param result function leave_org:initiate(result) if self.org == modpol.instance then modpol.interactions.message( @@ -35,5 +34,4 @@ function leave_org:initiate(result) self.org:delete_process(self.id) end ---- (Required) Add to module table modpol.modules.leave_org = leave_org diff --git a/modpol_core/modules/message_org.lua b/modpol_core/modules/message_org.lua index 8262989..90f0263 100644 --- a/modpol_core/modules/message_org.lua +++ b/modpol_core/modules/message_org.lua @@ -1,4 +1,4 @@ ---- message_org +--- Messages all org members -- @module message_org local message_org = { @@ -14,7 +14,9 @@ message_org.data = { message_org.config = { } +--- Allows user to send input message to all org members -- @function initiate +-- @param result function message_org:initiate(result) modpol.interactions.text_query( self.initiator, "Message to all org members: ", @@ -34,5 +36,4 @@ function message_org:initiate(result) self.org:delete_process(self.id) end ---- (Required) Add to module table modpol.modules.message_org = message_org diff --git a/modpol_core/modules/remove_child_consent.lua b/modpol_core/modules/remove_child_consent.lua index ba3255e..64f33de 100644 --- a/modpol_core/modules/remove_child_consent.lua +++ b/modpol_core/modules/remove_child_consent.lua @@ -1,6 +1,7 @@ --- Remove child (consent) -- A simple module that calls a consent process on an org to remove its child -- Depends on the Consent module. +-- @module remove_child_consent local remove_child_consent = { name = "Remove child (consent)", @@ -16,6 +17,9 @@ remove_child_consent.data = { remove_child_consent.config = { } +--- Removes a child org with consent +-- @function remove_child_consent:initiate +-- @param result function remove_child_consent:initiate(result) local children = {} for i,v in ipairs(self.org.children) do diff --git a/modpol_core/modules/remove_member_consent.lua b/modpol_core/modules/remove_member_consent.lua index fc118e1..1aafe29 100644 --- a/modpol_core/modules/remove_member_consent.lua +++ b/modpol_core/modules/remove_member_consent.lua @@ -1,4 +1,4 @@ ---- remove_member_consent +--- Calls consent to remove member from org -- @module remove_member_consent local remove_member_consent = { @@ -15,6 +15,9 @@ remove_member_consent.data = { remove_member_consent.config = { } +--- Removes given member from org +-- @function remove_member_consent:initiate +-- @param result function remove_member_consent:initiate(result) -- Abort if in root org if self.org == modpol.instance then @@ -60,5 +63,4 @@ function remove_member_consent:complete() if self.data.result then self.data.result() end end ---- (Required) Add to module table modpol.modules.remove_member_consent = remove_member_consent diff --git a/modpol_core/modules/remove_org.lua b/modpol_core/modules/remove_org.lua index b2118d1..f7fa5d7 100644 --- a/modpol_core/modules/remove_org.lua +++ b/modpol_core/modules/remove_org.lua @@ -1,8 +1,6 @@ ---- @module Remove Org --- A simple module that removes an org. +--- A simple module that removes an org. +-- @module remove_org - ---- Main module table remove_org = { name = "Remove this org", slug = "remove_org", @@ -12,8 +10,9 @@ remove_org = { remove_org.config = {} remove_org.data = {} ---- Initiate function --- @function initiate +--- Removes org +-- @function remove_org:initiate +-- @param result function remove_org:initiate(result) if self.org == modpol.instance then modpol.interactions.message( diff --git a/modpol_core/modules/remove_org_consent.lua b/modpol_core/modules/remove_org_consent.lua index f9e8513..11b3c97 100644 --- a/modpol_core/modules/remove_org_consent.lua +++ b/modpol_core/modules/remove_org_consent.lua @@ -1,6 +1,7 @@ --- Remove org (consent) -- A simple module that calls a consent process on an org to remove it. -- Depends on the Consent module. +-- @module remove_org_consent local remove_org_consent = { name = "Remove this org (consent)", @@ -15,6 +16,9 @@ remove_org_consent.data = { remove_org_consent.config = { } +--- Remove org if all members consent +-- @function remove_org_consent:initiate +-- @param result function remove_org_consent:initiate(result) if self.org == modpol.instance then modpol.interactions.message( diff --git a/modpol_core/modules/rename_org_consent.lua b/modpol_core/modules/rename_org_consent.lua index 1b9aa47..8e4336e 100644 --- a/modpol_core/modules/rename_org_consent.lua +++ b/modpol_core/modules/rename_org_consent.lua @@ -1,6 +1,7 @@ --- Rename org (consent) -- A simple module that calls a consent process on an org to rename it. -- Depends on the Consent module. +-- @module rename_org_consent local rename_org_consent = { name = "Rename this org (consent)", @@ -16,6 +17,9 @@ rename_org_consent.data = { rename_org_consent.config = { } +--- Renames the org after consent is reached +-- @function rename_org_consent:initiate +-- @param result function rename_org_consent:initiate(result) modpol.interactions.text_query( self.initiator,"New org name: ", @@ -63,6 +67,8 @@ function rename_org_consent:initiate(result) ) end +--- Changes the name of the org after consent is reached +-- @funciton rename_org_consent function rename_org_consent:complete() modpol.interactions.message_org( self.initiator, diff --git a/modpol_core/modules/template.lua b/modpol_core/modules/template.lua index aeb1a04..fd8efb9 100644 --- a/modpol_core/modules/template.lua +++ b/modpol_core/modules/template.lua @@ -38,7 +38,7 @@ module_template.config = { --
  • self.initiator (the user that callced the module),
  • --
  • self.id (the process id of the module instance)
  • -- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +-- @function module_template:initiate function module_template:initiate(result) -- call interaction functions here! diff --git a/modpol_core/util/misc.lua b/modpol_core/util/misc.lua index e213326..1cceeb8 100644 --- a/modpol_core/util/misc.lua +++ b/modpol_core/util/misc.lua @@ -1,7 +1,12 @@ +--- Miscellaneous functions +-- @module modpol.util.misc + modpol.util = {} ---- @function modpol.copy_table --- Returns a copy of the table inputted +--- Returns a copy of the table inputted +-- @function modpol.util.copy_table +-- @param t table to copy +-- @return copy of table function modpol.util.copy_table(t) local t2 = {} for k,v in pairs(t) do @@ -10,8 +15,10 @@ function modpol.util.copy_table(t) return t2 end ---- @function modpol.copy_table --- Returns the number of elements in a pairs table +--- Returns the number of elements in a pairs table +-- @function modpol.util.num_pairs +-- @param t pairs table +-- @return number of elements in pairs table function modpol.util.num_pairs(t) local i = 0 for k,v in pairs(t) do diff --git a/modpol_minetest/modules/priv_to_org.lua b/modpol_minetest/modules/priv_to_org.lua index 086fd0e..a97d0cd 100644 --- a/modpol_minetest/modules/priv_to_org.lua +++ b/modpol_minetest/modules/priv_to_org.lua @@ -1,6 +1,6 @@ --- Set privilege to org members --- @module priv_to_org -- Allows initiator to grant a priv they have to all members of an org +-- @module priv_to_org local priv_to_org = { name = "Set privilege to org members", @@ -14,9 +14,9 @@ priv_to_org.data = { priv_to_org.config = { } ---- (Required): initiate function --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- Initiate function +-- @function priv_to_org:initiate +-- @param result function priv_to_org:initiate(result) local player_privs = minetest.get_player_privs(self.initiator) -- construct table for display @@ -45,5 +45,4 @@ function priv_to_org:initiate(result) if result then result() end end ---- (Required) Add to module table modpol.modules.priv_to_org = priv_to_org From c8e911640e883ab0cafb111764fbd8c8ab063d50 Mon Sep 17 00:00:00 2001 From: SkylarHew Date: Thu, 20 Jan 2022 11:42:19 -0700 Subject: [PATCH 4/8] Edited README to include section on Documentation --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 28152e1..1c05a29 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,15 @@ Additionally, Modpol seeks to counteract the tendency for "[implicit feudalism]( It is certainly possible to use Modpol to replicate practices of implicit feudalism, such as all-powerful admins, but doing so requires extra work to overcome these defaults. +## Documentation (LDoc) + +Documentation was generated using LDoc. To generate basic documentation for every page, use the following command. + +``` +/modpol/documentation$ ldoc .. +``` + +This will not generate the same index page and sidebar as the documentation provided. ## Credits From 807ef6a150b777f5507a352c5ea128a3c97648da Mon Sep 17 00:00:00 2001 From: Nathan Schneider Date: Sat, 22 Jan 2022 11:28:38 -0700 Subject: [PATCH 5/8] Slight tweaks to ldoc docs --- docs/config.ld | 2 ++ {documentation => docs}/doc/index.html | 2 +- {documentation => docs}/doc/ldoc.css | 0 {documentation => docs}/doc/modules/add_child_org_consent.html | 0 {documentation => docs}/doc/modules/change_modules.html | 0 {documentation => docs}/doc/modules/consent.html | 0 {documentation => docs}/doc/modules/join_org.html | 0 {documentation => docs}/doc/modules/join_org_consent.html | 0 {documentation => docs}/doc/modules/join_org_consent.lua.html | 0 {documentation => docs}/doc/modules/leave_org.html | 0 {documentation => docs}/doc/modules/message_org.html | 0 {documentation => docs}/doc/modules/modpol.interactions.html | 0 {documentation => docs}/doc/modules/modpol.orgs.base.html | 0 {documentation => docs}/doc/modules/modpol.orgs.process.html | 0 {documentation => docs}/doc/modules/modpol.util.misc.html | 0 .../doc/modules/modpol_core.modules.join_org_consent.html | 0 .../doc/modules/modpol_core.modules.remove_org_consent.html | 0 {documentation => docs}/doc/modules/modpol_minetest.api.html | 0 {documentation => docs}/doc/modules/module_template.html | 0 {documentation => docs}/doc/modules/priv_to_org.html | 0 {documentation => docs}/doc/modules/remove_child_consent.html | 0 {documentation => docs}/doc/modules/remove_member_consent.html | 0 {documentation => docs}/doc/modules/remove_org.html | 0 {documentation => docs}/doc/modules/remove_org_consent.html | 0 {documentation => docs}/doc/modules/rename_org_consent.html | 0 {documentation => docs}/headers_template.html | 0 documentation/config.ld | 2 -- 27 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 docs/config.ld rename {documentation => docs}/doc/index.html (99%) rename {documentation => docs}/doc/ldoc.css (100%) rename {documentation => docs}/doc/modules/add_child_org_consent.html (100%) rename {documentation => docs}/doc/modules/change_modules.html (100%) rename {documentation => docs}/doc/modules/consent.html (100%) rename {documentation => docs}/doc/modules/join_org.html (100%) rename {documentation => docs}/doc/modules/join_org_consent.html (100%) rename {documentation => docs}/doc/modules/join_org_consent.lua.html (100%) rename {documentation => docs}/doc/modules/leave_org.html (100%) rename {documentation => docs}/doc/modules/message_org.html (100%) rename {documentation => docs}/doc/modules/modpol.interactions.html (100%) rename {documentation => docs}/doc/modules/modpol.orgs.base.html (100%) rename {documentation => docs}/doc/modules/modpol.orgs.process.html (100%) rename {documentation => docs}/doc/modules/modpol.util.misc.html (100%) rename {documentation => docs}/doc/modules/modpol_core.modules.join_org_consent.html (100%) rename {documentation => docs}/doc/modules/modpol_core.modules.remove_org_consent.html (100%) rename {documentation => docs}/doc/modules/modpol_minetest.api.html (100%) rename {documentation => docs}/doc/modules/module_template.html (100%) rename {documentation => docs}/doc/modules/priv_to_org.html (100%) rename {documentation => docs}/doc/modules/remove_child_consent.html (100%) rename {documentation => docs}/doc/modules/remove_member_consent.html (100%) rename {documentation => docs}/doc/modules/remove_org.html (100%) rename {documentation => docs}/doc/modules/remove_org_consent.html (100%) rename {documentation => docs}/doc/modules/rename_org_consent.html (100%) rename {documentation => docs}/headers_template.html (100%) delete mode 100644 documentation/config.ld diff --git a/docs/config.ld b/docs/config.ld new file mode 100644 index 0000000..9492f75 --- /dev/null +++ b/docs/config.ld @@ -0,0 +1,2 @@ +project = 'Modpol' +description = 'modpol core' diff --git a/documentation/doc/index.html b/docs/doc/index.html similarity index 99% rename from documentation/doc/index.html rename to docs/doc/index.html index ee3531b..7d54b20 100644 --- a/documentation/doc/index.html +++ b/docs/doc/index.html @@ -24,7 +24,7 @@ @@ -77,6 +78,10 @@ add_child_org_consent Adds a child org. + + change_modules + change_modules + change_modules change_modules @@ -86,6 +91,18 @@ consent A utility module for checking consent + + create_token + Create token. + + + defer_consent + Defer consent + + + display_processes + Display processes + join_org Adds a user to org @@ -102,11 +119,13 @@ message_org Messages all org members + + randomizer + A utility module that outputs a random result from a set of options + remove_child_consent - Remove child (consent) - A simple module that calls a consent process on an org to remove its child - Depends on the Consent module. + Remove child (consent). remove_member_consent @@ -121,14 +140,26 @@ Remove org (consent) A simple module that calls a consent process on an org to remove it. + + remove_process + Remove a process + rename_org_consent Rename org (consent) A simple module that calls a consent process on an org to rename it. + + send_token + Send token. + module_template - Template for module writers + Template for module writers. + + + tokenomics + Tokenomics. modpol.orgs.base @@ -151,13 +182,19 @@ Set privilege to org members Allows initiator to grant a priv they have to all members of an org + + modpol_minetest.overrides.interactions + INTERACTIONS.LUA (for Minetest) + CONTEXTUAL STUFF + ================ +
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/add_child_org_consent.html b/docs/doc/modules/add_child_org_consent.html index 52ba72f..9826d97 100644 --- a/docs/doc/modules/add_child_org_consent.html +++ b/docs/doc/modules/add_child_org_consent.html @@ -24,7 +24,7 @@ @@ -107,7 +108,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -137,7 +138,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/change_modules.html b/docs/doc/modules/change_modules.html index 4e043de..6779a7d 100644 --- a/docs/doc/modules/change_modules.html +++ b/docs/doc/modules/change_modules.html @@ -24,7 +24,7 @@ @@ -80,13 +81,9 @@

    Functions

    - + - - - -
    initiate ()initiate (result) Initiate change in modules.
    propose_change (type, mod_text)propose_change

    @@ -98,34 +95,17 @@
    - initiate () + initiate (result)
    Initiate change in modules. Either adds or removes module depending on user input - - - - - -
    -
    - - propose_change (type, mod_text) -
    -
    - propose_change - -

    Parameters:

      -
    • type - -
    • -
    • mod_text - +
    • result + Callback if this module is embedded in other modules
    @@ -141,7 +121,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/consent.html b/docs/doc/modules/consent.html index 88c1c28..85c01a8 100644 --- a/docs/doc/modules/consent.html +++ b/docs/doc/modules/consent.html @@ -24,7 +24,7 @@ @@ -106,7 +107,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -142,7 +143,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/join_org_consent.lua.html b/docs/doc/modules/create_token.html similarity index 70% rename from docs/doc/modules/join_org_consent.lua.html rename to docs/doc/modules/create_token.html index 2949a4b..1305190 100644 --- a/docs/doc/modules/join_org_consent.lua.html +++ b/docs/doc/modules/create_token.html @@ -24,7 +24,7 @@
    -

    Module join_org_consent.lua

    -

    Join org (consent).

    +

    Module create_token

    +

    Create token.

    - A simple module that calls a consent process on an org to add a member. - Depends on the Consent module.

    + Depends on tokenomics

    Functions

    - - - - - - + +
    join_org_consent:initiate (result)Initiate join org with consent
    join_org_consent:complete ()Adds member to org, notifies org, and deletes processcreate_toke:initiate (result)Initiate function
    @@ -98,17 +94,17 @@
    - - join_org_consent:initiate (result) + + create_toke:initiate (result)
    - Initiate join org with consent + Initiate function

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -116,20 +112,6 @@ -
    -
    - - join_org_consent:complete () -
    -
    - Adds member to org, notifies org, and deletes process - - - - - - -
    @@ -138,7 +120,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:46:26 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/defer_consent.html b/docs/doc/modules/defer_consent.html new file mode 100644 index 0000000..f6c2807 --- /dev/null +++ b/docs/doc/modules/defer_consent.html @@ -0,0 +1,190 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module defer_consent

    +

    Defer consent

    +

    + + +

    Functions

    + + + + + +
    initiate (result)Initiate function
    +

    Tables

    + + + + + +
    configConfig for module
    +

    Fields

    + + + + + +
    modpol.modules.defer_consent(Required) Add to module table
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate function + + +

    Parameters:

    +
      +
    • result + Callback if this module is embedded in other modules +
    • +
    + + + + + +
    +
    +

    Tables

    + +
    +
    + + config +
    +
    + Config for module + + +

    Fields:

    +
      +
    • defer_org + Name or ID of target org +
    • +
    • votes_required + Threshold passed on to `consent` +
    • +
    • prompt + String passed on to `consent` +
    • +
    + + + + + +
    +
    +

    Fields

    + +
    +
    + + modpol.modules.defer_consent +
    +
    + (Required) Add to module table + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-23 18:18:51 +
    +
    + + diff --git a/docs/doc/modules/modpol_core.modules.remove_org_consent.html b/docs/doc/modules/display_processes.html similarity index 75% rename from docs/doc/modules/modpol_core.modules.remove_org_consent.html rename to docs/doc/modules/display_processes.html index a8108e6..e64806b 100644 --- a/docs/doc/modules/modpol_core.modules.remove_org_consent.html +++ b/docs/doc/modules/display_processes.html @@ -24,7 +24,7 @@
    -

    Module modpol_core.modules.remove_org_consent

    -

    Remove org (consent) - A simple module that calls a consent process on an org to remove it.

    -

    - Depends on the Consent module.

    +

    Module display_processes

    +

    Display processes

    +

    Functions

    - +
    initiate (result)Remove org if all members consentInitiate function
    @@ -98,13 +97,13 @@ initiate (result)
    - Remove org if all members consent + Initiate function

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -120,7 +119,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:30:14 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/join_org.html b/docs/doc/modules/join_org.html index bc279e9..f936507 100644 --- a/docs/doc/modules/join_org.html +++ b/docs/doc/modules/join_org.html @@ -24,7 +24,7 @@ @@ -102,7 +103,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -118,7 +119,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/join_org_consent.html b/docs/doc/modules/join_org_consent.html index 9e2bbc4..15126bf 100644 --- a/docs/doc/modules/join_org_consent.html +++ b/docs/doc/modules/join_org_consent.html @@ -24,7 +24,7 @@ @@ -108,7 +109,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -138,7 +139,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/leave_org.html b/docs/doc/modules/leave_org.html index 760f967..c2ba803 100644 --- a/docs/doc/modules/leave_org.html +++ b/docs/doc/modules/leave_org.html @@ -24,7 +24,7 @@ @@ -102,7 +103,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -118,7 +119,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/message_org.html b/docs/doc/modules/message_org.html index e34e38d..5bfd0af 100644 --- a/docs/doc/modules/message_org.html +++ b/docs/doc/modules/message_org.html @@ -24,7 +24,7 @@ @@ -102,7 +103,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -118,7 +119,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/modpol.interactions.html b/docs/doc/modules/modpol.interactions.html index 6c28f6c..a3a65b0 100644 --- a/docs/doc/modules/modpol.interactions.html +++ b/docs/doc/modules/modpol.interactions.html @@ -24,7 +24,7 @@ @@ -89,19 +90,36 @@ Output: Displays a menu of org-specific commands to the user - modpol.interactions.message (user, message) - Output: Prints message to CLI + modpol.interactions.user_dashboard (viewer, user, completion) + Function: modpol.interactions.user_dashboard + Displays a dashboard about a particular user - modpol.interactions.text_query (user, query, func) - Output: Applies "func" to user input. + modpol.interactions.message (user, message) + Prints message to CLI. + + + modpol.interactions.message_user (sender, recipient) + Gets and sends a message from one user to another + + + modpol.interactions.display (user, title, message, done) + Displays complex data to a user + + + modpol.interactions.text_query (User, Query, func) + Applies "func" to user input. modpol.interactions.dropdown_query (user, label, options, func) Output: Calls func on choice. - modpol.binary_poll_user (user, question, func) + modpol.interactions.checkbox_query (user, label, options, func) + Allows user to select from a set of options + + + modpol.interactions.binary_poll_user (user, question, func) Output: Applies "func" to user input. @@ -159,13 +177,41 @@ +
    +
    + + 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)
    - Output: Prints message to CLI + Prints message to CLI. + Buttons: message, done

    Parameters:

    @@ -184,20 +230,72 @@
    - - modpol.interactions.text_query (user, query, func) + + modpol.interactions.message_user (sender, recipient)
    - Output: Applies "func" to user input. - Func input: user input (string) + 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:

    +
    @@ -120,7 +139,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/remove_member_consent.html b/docs/doc/modules/remove_member_consent.html index afc2639..72545ae 100644 --- a/docs/doc/modules/remove_member_consent.html +++ b/docs/doc/modules/remove_member_consent.html @@ -24,7 +24,7 @@
    @@ -81,6 +83,10 @@ initiate (result) Removes given member from org + + complete () + Complete after consent +
    @@ -101,7 +107,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -109,6 +115,20 @@ + +
    + + complete () +
    +
    + Complete after consent + + + + + + +
    @@ -117,7 +137,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/remove_org.html b/docs/doc/modules/remove_org.html index 88c8ee8..b42d327 100644 --- a/docs/doc/modules/remove_org.html +++ b/docs/doc/modules/remove_org.html @@ -24,7 +24,7 @@ @@ -102,7 +103,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -118,7 +119,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/remove_org_consent.html b/docs/doc/modules/remove_org_consent.html index d409d74..5ba6665 100644 --- a/docs/doc/modules/remove_org_consent.html +++ b/docs/doc/modules/remove_org_consent.html @@ -24,7 +24,7 @@ @@ -84,6 +85,10 @@ initiate (result) Remove org if all members consent + + complete () + Complete after consent +
    @@ -104,7 +109,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -112,6 +117,20 @@ + +
    + + complete () +
    +
    + Complete after consent + + + + + + +
    @@ -120,7 +139,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/modpol_core.modules.join_org_consent.html b/docs/doc/modules/remove_process.html similarity index 75% rename from docs/doc/modules/modpol_core.modules.join_org_consent.html rename to docs/doc/modules/remove_process.html index 89dad99..5f56e4b 100644 --- a/docs/doc/modules/modpol_core.modules.join_org_consent.html +++ b/docs/doc/modules/remove_process.html @@ -24,7 +24,7 @@
    -

    Module modpol_core.modules.join_org_consent

    -

    Join org (consent).

    -

    - A simple module that calls a consent process on an org to add a member. - Depends on the Consent module.

    +

    Module remove_process

    +

    Remove a process

    +

    Functions

    - - - - - +
    initiate (result)Initiate join org with consent
    complete ()Adds member to org, notifies org, and deletes processInitiate function
    @@ -102,13 +97,13 @@ initiate (result)
    - Initiate join org with consent + Initiate function

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -116,20 +111,6 @@ -
    -
    - - complete () -
    -
    - Adds member to org, notifies org, and deletes process - - - - - - -
    @@ -138,7 +119,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:46:04 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/rename_org_consent.html b/docs/doc/modules/rename_org_consent.html index 29abba5..2234db9 100644 --- a/docs/doc/modules/rename_org_consent.html +++ b/docs/doc/modules/rename_org_consent.html @@ -24,7 +24,7 @@ @@ -108,7 +109,7 @@

    Parameters:

    • result - + Callback if this module is embedded in other modules
    @@ -138,7 +139,7 @@
    generated by LDoc 1.4.6 -Last updated 2022-01-20 10:54:01 +Last updated 2022-01-23 18:18:51
    diff --git a/docs/doc/modules/send_token.html b/docs/doc/modules/send_token.html new file mode 100644 index 0000000..c0df915 --- /dev/null +++ b/docs/doc/modules/send_token.html @@ -0,0 +1,157 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module send_token

    +

    Send token.

    +

    + Depends on tokenomics

    + + +

    Functions

    + + + + + +
    initiate (result)initiate function
    +

    Tables

    + + + + + +
    data(Required) Data for module + Variables that module uses during the course of a process + Can be blank
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + initiate function + + +

    Parameters:

    +
      +
    • result + Callback if this module is embedded in other modules +
    • +
    + + + + + +
    +
    +

    Tables

    + +
    +
    + + data +
    +
    + (Required) Data for module + Variables that module uses during the course of a process + Can be blank + + + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-23 18:18:51 +
    +
    + + diff --git a/docs/doc/modules/tokenomics.html b/docs/doc/modules/tokenomics.html new file mode 100644 index 0000000..f16018d --- /dev/null +++ b/docs/doc/modules/tokenomics.html @@ -0,0 +1,357 @@ + + + + + Reference + + + + +
    + +
    + +
    +
    +
    + + +
    + + + + + + +
    + +

    Module tokenomics

    +

    Tokenomics.

    +

    + Depends on consent

    + + +

    Functions

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    initiate (result)Initiate function: creates a token in an org.
    create_token ()Create token
    balance (org, token, user)Returns balance.
    change_balance (org, token, user, amount)Change balance
    transfer (org, token, sender, recipient, amount)Transfer tokens from a sender to recipient
    treasury_transfer (org, token, recipient, amount)Transfer from treasury
    issue (org, token, amount)Creates new tokens in the org treasury
    +

    Tables

    + + + + + +
    configConfig for module
    + +
    +
    + + +

    Functions

    + +
    +
    + + initiate (result) +
    +
    + Initiate function: creates a token in an org. + Set up the token data structure. + Create an org treasury + + +

    Parameters:

    +
      +
    • result + (optional) Callback if this module is embedded in other modules +
    • +
    + + + + + +
    +
    + + create_token () +
    +
    + Create token + + + + + + + +
    +
    + + balance (org, token, user) +
    +
    + Returns balance. + If no user, get treasury balance + + +

    Parameters:

    +
      +
    • org + Name (string) or id (num) +
    • +
    • token + Slug (string) +
    • +
    • user + Name (string) +
    • +
    + + + + + +
    +
    + + change_balance (org, token, user, amount) +
    +
    + Change balance + + +

    Parameters:

    +
      +
    • org + Org name (string) or id (number) +
    • +
    • token + Token slug (string) +
    • +
    • user + +
    • +
    • amount + +
    • +
    + + + + + +
    +
    + + transfer (org, token, sender, recipient, amount) +
    +
    + Transfer tokens from a sender to recipient + + +

    Parameters:

    +
      +
    • org + +
    • +
    • token + +
    • +
    • sender + +
    • +
    • recipient + +
    • +
    • amount + Positive number +
    • +
    + + + + + +
    +
    + + treasury_transfer (org, token, recipient, amount) +
    +
    + Transfer from treasury + + +

    Parameters:

    +
      +
    • org + +
    • +
    • token + +
    • +
    • recipient + +
    • +
    • amount + Can be positive or negative, assumes flow from treasury to recipient +
    • +
    + + + + + +
    +
    + + issue (org, token, amount) +
    +
    + Creates new tokens in the org treasury + + +

    Parameters:

    +
      +
    • org + +
    • +
    • token + +
    • +
    • amount + +
    • +
    + + + + + +
    +
    +

    Tables

    + +
    +
    + + config +
    +
    + Config for module + + +

    Fields:

    +
      +
    • consent + Require consent to create? +
    • +
    • token_variables + the data that goes into the token +
    • +
    • token_slug + A no-spaces slug for the token +
    • +
    • initial_treasury + Quantity in org treasury +
    • +
    • negative_spend + Boolean: can users spend negative tokens? (for mutual credit) +
    • +
    • balances + Table of user balances +
    • +
    + + + + + +
    +
    + + +
    +
    +
    +generated by LDoc 1.4.6 +Last updated 2022-01-23 18:18:51 +
    +
    + + From 79b548f9a0c29a04a8780266de30d772ef40db2c Mon Sep 17 00:00:00 2001 From: SkylarHew Date: Sun, 23 Jan 2022 18:21:23 -0700 Subject: [PATCH 8/8] Added LDoc comments for new files, ready to merge pt. 2 --- modpol_core/interactions/interactions.lua | 24 +++++----- modpol_core/modules/add_child_org_consent.lua | 2 +- .../modules/change_modules-dropdown.lua | 15 ++++-- modpol_core/modules/change_modules.lua | 1 + modpol_core/modules/consent.lua | 2 +- modpol_core/modules/create_token.lua | 14 ++---- modpol_core/modules/defer_consent.lua | 18 ++------ modpol_core/modules/display_processes.lua | 12 ++--- modpol_core/modules/join_org.lua | 2 +- modpol_core/modules/join_org_consent.lua | 2 +- modpol_core/modules/leave_org.lua | 2 +- modpol_core/modules/message_org.lua | 2 +- modpol_core/modules/randomizer.lua | 10 ++-- modpol_core/modules/remove_child_consent.lua | 8 ++-- modpol_core/modules/remove_member_consent.lua | 4 +- modpol_core/modules/remove_org.lua | 2 +- modpol_core/modules/remove_org_consent.lua | 4 +- modpol_core/modules/remove_process.lua | 13 ++---- modpol_core/modules/rename_org_consent.lua | 2 +- modpol_core/modules/send_token.lua | 11 ++--- modpol_core/modules/template.lua | 5 +- modpol_core/modules/tokenomics.lua | 46 +++++++++++++------ modpol_core/orgs/process.lua | 8 +++- modpol_minetest/overrides/interactions.lua | 3 +- 24 files changed, 118 insertions(+), 94 deletions(-) diff --git a/modpol_core/interactions/interactions.lua b/modpol_core/interactions/interactions.lua index 37f05be..1581e78 100644 --- a/modpol_core/interactions/interactions.lua +++ b/modpol_core/interactions/interactions.lua @@ -256,8 +256,8 @@ function modpol.interactions.message(user, message) print(user .. ": " .. message) end ---- Function: modpol.interactions.message_user --- Gets and sends a message from one user to another +--- Gets and sends a message from one user to another +-- @function modpol.interactions.message_user -- @param sender Name of user sending (string) -- @param recipient Name of user receiving (string) function modpol.interactions.message_user(sender, recipient) @@ -268,8 +268,9 @@ function modpol.interactions.message_user(sender, recipient) sel.." [from "..sender.."]") end ---- Function: modpol.interactions.display --- Displays complex data to a user + +--- Displays complex data to a user +-- @function modpol.interactions.display -- @param user Name of target user (string) -- @param title Title of display (string) -- @param message Content of message (string or table of strings) @@ -301,7 +302,7 @@ function modpol.interactions.display(user, title, message, completion) end --- Applies "func" to user input +--- Applies "func" to user input. -- Func input: user input (string) -- @function modpol.interactions.text_query -- @param User (string) @@ -314,7 +315,7 @@ function modpol.interactions.text_query(user, query, func) end --- Output: Calls func on choice. --- func input: choice (string) +-- Func input: choice (string) -- @function modpol.interactions.dropdown_query -- @param user (string) -- @param label (string) @@ -405,10 +406,12 @@ function modpol.interactions.checkbox_query( end --- Function: modpol.interactions.binary_poll_user --- Params: user (string), question (string), func (function) --- func input: user input (string: y/n) --- Output: Applies "func" to user input +--- Output: Applies "func" to user input. +-- Func input: user input (string: y/n) +-- @function modpol.interactions.binary_poll_user +-- @param user (string) +-- @param question (string) +-- @param func (function) function modpol.interactions.binary_poll_user(user, question, func) local query = "Poll for " .. user .. " (y/n): ".. question local answer @@ -435,7 +438,6 @@ end -- @param initiator (string) -- @param org (number or string) -- @param message (string) - function modpol.interactions.message_org(initiator, org, message) local this_org = modpol.orgs.get_org(org) local users = this_org:list_members() diff --git a/modpol_core/modules/add_child_org_consent.lua b/modpol_core/modules/add_child_org_consent.lua index f98aebc..34d2c7f 100644 --- a/modpol_core/modules/add_child_org_consent.lua +++ b/modpol_core/modules/add_child_org_consent.lua @@ -16,7 +16,7 @@ add_child_org_consent.config = { --- Initiate consent for new child org -- @function add_child_org_consent:initiate(result) --- @param result +-- @param result Callback if this module is embedded in other modules function add_child_org_consent:initiate(result) modpol.interactions.text_query( self.initiator,"Child org name: ", diff --git a/modpol_core/modules/change_modules-dropdown.lua b/modpol_core/modules/change_modules-dropdown.lua index ae651ec..efeb3d9 100644 --- a/modpol_core/modules/change_modules-dropdown.lua +++ b/modpol_core/modules/change_modules-dropdown.lua @@ -16,6 +16,9 @@ change_modules.data = { change_modules.config = { } +--- Change modules initiate +-- @function change_modules:initiate +-- @param result Callback if this module is embedded in other modules function change_modules:initiate(result) self.data.result = result -- Step 1: add or remove? @@ -32,6 +35,8 @@ function change_modules:initiate(result) ) end +--- Add a new module +-- @function change_modules:add_module function change_modules:add_module() -- prepare module options local available_modules = modpol.util.copy_table(modpol.modules) @@ -78,6 +83,8 @@ function change_modules:add_module() ) end +--- Remove a module +-- @function change_modules:remove_module function change_modules:remove_module() -- prepare module options local available_modules = {} @@ -125,8 +132,11 @@ function change_modules:remove_module() ) end ---- propose_change --- @field type "add" or "remove" +--- Propose a change. +-- Type "add" or "remove" +-- @function change_modules:propose_change +-- @param type +-- @param mod_text function change_modules:propose_change(type, mod_text) self:call_module( "consent",self.initiator, @@ -165,5 +175,4 @@ function change_modules:propose_change(type, mod_text) self.org:delete_process(self.id) end ---- (Required) Add to module table modpol.modules.change_modules = change_modules diff --git a/modpol_core/modules/change_modules.lua b/modpol_core/modules/change_modules.lua index b43e5b0..beec34d 100644 --- a/modpol_core/modules/change_modules.lua +++ b/modpol_core/modules/change_modules.lua @@ -22,6 +22,7 @@ change_modules.config = { --- Initiate change in modules. -- Either adds or removes module depending on user input -- @function change_modules:initiate +-- @param result Callback if this module is embedded in other modules function change_modules:initiate(result) self.data.result = result self.data.add_modules = {} diff --git a/modpol_core/modules/consent.lua b/modpol_core/modules/consent.lua index bb1acfe..4311421 100644 --- a/modpol_core/modules/consent.lua +++ b/modpol_core/modules/consent.lua @@ -19,7 +19,7 @@ consent.config = { --- Initiate consent -- @function consent:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function consent:initiate(result) self.data.result = result -- if org is empty, consent is given automatically diff --git a/modpol_core/modules/create_token.lua b/modpol_core/modules/create_token.lua index 6f4c30c..e8becdd 100644 --- a/modpol_core/modules/create_token.lua +++ b/modpol_core/modules/create_token.lua @@ -1,6 +1,6 @@ ---- create_token +--- Create token. +-- Depends on tokenomics -- @module create_token --- depends on tokenomics local create_token = { name = "Create a token (consent)", @@ -9,9 +9,6 @@ local create_token = { hide = false; } ---- (Required) Data for module --- Variables that module uses during the course of a process --- Can be blank create_token.data = { } @@ -19,9 +16,9 @@ create_token.config = { token_name = "" } ---- (Required): initiate function --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- Initiate function +-- @function create_toke:initiate +-- @param result Callback if this module is embedded in other modules function create_token:initiate(result) modpol.interactions.text_query( self.initiator, @@ -49,5 +46,4 @@ function create_token:initiate(result) ) end ---- (Required) Add to module table modpol.modules.create_token = create_token diff --git a/modpol_core/modules/defer_consent.lua b/modpol_core/modules/defer_consent.lua index b931bf8..60492bc 100644 --- a/modpol_core/modules/defer_consent.lua +++ b/modpol_core/modules/defer_consent.lua @@ -1,11 +1,6 @@ ---- defer_consent +--- Defer consent -- @module defer_consent ---- (Required): data table containing name and description of the module --- @field name "Human-readable name (parens OK, no brackets)" --- @field slug "Same as module class name" --- @field desc "Description of the module" --- @field hide "Whether this is a hidden utility module" local defer_consent = { name = "Defer consent", slug = "defer_consent", @@ -13,13 +8,10 @@ local defer_consent = { hide = true; } ---- (Required) Data for module --- Variables that module uses during the course of a process --- Can be blank defer_consent.data = { } ---- (Required): config for module +--- Config for module -- @field defer_org Name or ID of target org -- @field votes_required Threshold passed on to `consent` -- @field prompt String passed on to `consent` @@ -29,9 +21,9 @@ defer_consent.config = { prompt = "Do you consent?" } ---- (Required): initiate function --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- Initiate function +-- @param result Callback if this module is embedded in other modules +-- @function defer_consent:initiate function defer_consent:initiate(result) local defer_org = modpol.orgs.get_org(self.config.defer_org) if not defer_org then diff --git a/modpol_core/modules/display_processes.lua b/modpol_core/modules/display_processes.lua index c851fc5..e2feb21 100644 --- a/modpol_core/modules/display_processes.lua +++ b/modpol_core/modules/display_processes.lua @@ -1,4 +1,4 @@ ---- display_processes +--- Display processes -- @module display_processes local display_processes = { @@ -8,18 +8,15 @@ local display_processes = { hide = false; } ---- (Required) Data for module --- Variables that module uses during the course of a process --- Can be blank display_processes.data = { } display_processes.config = { } ---- (Required): initiate function --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- Initiate function +-- @function display_processes:initiate +-- @param result Callback if this module is embedded in other modules function display_processes:initiate(result) local display_table = {} for k,v in pairs(self.org.processes) do @@ -66,5 +63,4 @@ function display_processes:initiate(result) ) end ---- (Required) Add to module table modpol.modules.display_processes = display_processes diff --git a/modpol_core/modules/join_org.lua b/modpol_core/modules/join_org.lua index 8405ac6..ae78a4e 100644 --- a/modpol_core/modules/join_org.lua +++ b/modpol_core/modules/join_org.lua @@ -11,7 +11,7 @@ join_org.setup = { --- Adds the user to the org -- @function join_org.initiate --- @param result +-- @param result Callback if this module is embedded in other modules function join_org.initiate(result) modpol.interactions.binary_poll_user( initiator, diff --git a/modpol_core/modules/join_org_consent.lua b/modpol_core/modules/join_org_consent.lua index 408aadc..79423f8 100644 --- a/modpol_core/modules/join_org_consent.lua +++ b/modpol_core/modules/join_org_consent.lua @@ -18,7 +18,7 @@ join_org_consent.config = { --- Initiate join org with consent -- @function join_org_consent:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function join_org_consent:initiate(result) if self.org:has_member(self.initiator) then modpol.interactions.message( diff --git a/modpol_core/modules/leave_org.lua b/modpol_core/modules/leave_org.lua index 2ba71ee..60ef085 100644 --- a/modpol_core/modules/leave_org.lua +++ b/modpol_core/modules/leave_org.lua @@ -15,7 +15,7 @@ leave_org.config = { --- Removes user from org -- @function leave_org:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function leave_org:initiate(result) if self.org == modpol.instance then modpol.interactions.message( diff --git a/modpol_core/modules/message_org.lua b/modpol_core/modules/message_org.lua index 90f0263..a251e5f 100644 --- a/modpol_core/modules/message_org.lua +++ b/modpol_core/modules/message_org.lua @@ -16,7 +16,7 @@ message_org.config = { --- Allows user to send input message to all org members -- @function initiate --- @param result +-- @param result Callback if this module is embedded in other modules function message_org:initiate(result) modpol.interactions.text_query( self.initiator, "Message to all org members: ", diff --git a/modpol_core/modules/randomizer.lua b/modpol_core/modules/randomizer.lua index fa45851..59061c1 100644 --- a/modpol_core/modules/randomizer.lua +++ b/modpol_core/modules/randomizer.lua @@ -1,5 +1,5 @@ ---- @module randomizer --- A utility module that outputs a random result from a set of options +--- A utility module that outputs a random result from a set of options +-- @module randomizer local randomizer = { name = "Randomizer", @@ -18,6 +18,9 @@ randomizer.config = { result_table = {} } +--- Initiate function +-- @function randomizer:initiate +-- @param result Callback if this module is embedded in other modules function randomizer:initiate(result) self.data.result = result self.data.options_table = modpol.util.copy_table(self.config.options_table) @@ -32,7 +35,8 @@ function randomizer:initiate(result) end end --- returns result_table +--- Returns result_table +-- @function randomizer:random_loop function randomizer:random_loop() self.data.results = 0 if results == self.config.num_results then diff --git a/modpol_core/modules/remove_child_consent.lua b/modpol_core/modules/remove_child_consent.lua index e598457..e2bceb9 100644 --- a/modpol_core/modules/remove_child_consent.lua +++ b/modpol_core/modules/remove_child_consent.lua @@ -1,5 +1,5 @@ ---- Remove child (consent) --- A simple module that calls a consent process on an org to remove its child +--- Remove child (consent). +-- A simple module that calls a consent process on an org to remove its child. -- Depends on the Consent module. -- @module remove_child_consent @@ -19,7 +19,7 @@ remove_child_consent.config = { --- Removes a child org with consent -- @function remove_child_consent:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function remove_child_consent:initiate(result) local children = {} for i,v in ipairs(self.org.children) do @@ -58,6 +58,8 @@ function remove_child_consent:initiate(result) end end +--- Complete the remove process +-- @function remove_child_consent:complete function remove_child_consent:complete() modpol.interactions.message_org( self.initiator, self.data.child_to_remove.id, diff --git a/modpol_core/modules/remove_member_consent.lua b/modpol_core/modules/remove_member_consent.lua index 1e21072..8a5a4fe 100644 --- a/modpol_core/modules/remove_member_consent.lua +++ b/modpol_core/modules/remove_member_consent.lua @@ -17,7 +17,7 @@ remove_member_consent.config = { --- Removes given member from org -- @function remove_member_consent:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function remove_member_consent:initiate(result) -- Abort if in root org if self.org == modpol.instance then @@ -52,6 +52,8 @@ function remove_member_consent:initiate(result) end end +--- Complete after consent +-- @function remove_member_consent:complete function remove_member_consent:complete() modpol.interactions.message_org( self.initiator, self.org.id, diff --git a/modpol_core/modules/remove_org.lua b/modpol_core/modules/remove_org.lua index f7fa5d7..eb217f8 100644 --- a/modpol_core/modules/remove_org.lua +++ b/modpol_core/modules/remove_org.lua @@ -12,7 +12,7 @@ remove_org.data = {} --- Removes org -- @function remove_org:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function remove_org:initiate(result) if self.org == modpol.instance then modpol.interactions.message( diff --git a/modpol_core/modules/remove_org_consent.lua b/modpol_core/modules/remove_org_consent.lua index b241d7c..61ad4a2 100644 --- a/modpol_core/modules/remove_org_consent.lua +++ b/modpol_core/modules/remove_org_consent.lua @@ -18,7 +18,7 @@ remove_org_consent.config = { --- Remove org if all members consent -- @function remove_org_consent:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function remove_org_consent:initiate(result) if self.org == modpol.instance then modpol.interactions.message( @@ -44,6 +44,8 @@ function remove_org_consent:initiate(result) end end +--- Complete after consent +-- @function remove_org_consent:complete function remove_org_consent:complete() modpol.interactions.message_org( self.initiator, self.org.id, diff --git a/modpol_core/modules/remove_process.lua b/modpol_core/modules/remove_process.lua index b5c5339..13b12e2 100644 --- a/modpol_core/modules/remove_process.lua +++ b/modpol_core/modules/remove_process.lua @@ -1,4 +1,4 @@ ---- remove_process +--- Remove a process -- @module remove_process local remove_process = { @@ -8,18 +8,15 @@ local remove_process = { hide = false; } ---- (Required) Data for module --- Variables that module uses during the course of a process --- Can be blank remove_process.data = { } remove_process.config = { } ---- (Required): initiate function --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- Initiate function +-- @function remove_process:initiate +-- @param result Callback if this module is embedded in other modules function remove_process:initiate(result) -- prepare process options local available_processes = {} @@ -108,6 +105,4 @@ function remove_process:initiate(result) ) end - ---- (Required) Add to module table modpol.modules.remove_process = remove_process diff --git a/modpol_core/modules/rename_org_consent.lua b/modpol_core/modules/rename_org_consent.lua index d5a3369..49629b1 100644 --- a/modpol_core/modules/rename_org_consent.lua +++ b/modpol_core/modules/rename_org_consent.lua @@ -19,7 +19,7 @@ rename_org_consent.config = { --- Renames the org after consent is reached -- @function rename_org_consent:initiate --- @param result +-- @param result Callback if this module is embedded in other modules function rename_org_consent:initiate(result) modpol.interactions.text_query( self.initiator,"New org name: ", diff --git a/modpol_core/modules/send_token.lua b/modpol_core/modules/send_token.lua index 84e0019..98d629b 100644 --- a/modpol_core/modules/send_token.lua +++ b/modpol_core/modules/send_token.lua @@ -1,6 +1,6 @@ ---- send_token +--- Send token. +-- Depends on tokenomics -- @module send_token --- depends on tokenomics local send_token = { name = "Send tokens", @@ -19,9 +19,9 @@ send_token.config = { token_name = "" } ---- (Required): initiate function --- @param result (optional) Callback if this module is embedded in other modules --- @function initiate +--- initiate function +-- @function send_token:initiate +-- @param result Callback if this module is embedded in other modules function send_token:initiate(result) local token_list = {} if self.org.tokens then @@ -73,5 +73,4 @@ function send_token:initiate(result) end end ---- (Required) Add to module table modpol.modules.send_token = send_token diff --git a/modpol_core/modules/template.lua b/modpol_core/modules/template.lua index 4987740..3a4c531 100644 --- a/modpol_core/modules/template.lua +++ b/modpol_core/modules/template.lua @@ -1,4 +1,5 @@ ---- Template for module writers +--- Template for module writers. +-- Short description goes here. -- @module module_template --- (Required): Data table containing name and description of the module @@ -37,8 +38,8 @@ module_template.config = { --
  • self.org (the org the module was called in),
  • --
  • self.initiator (the user that callced the module),
  • --
  • self.id (the process id of the module instance)
  • --- @param result (optional) Callback if this module is embedded in other modules -- @function module_template:initiate +-- @param result (optional) Callback if this module is embedded in other modules function module_template:initiate(result) -- call interaction functions here! diff --git a/modpol_core/modules/tokenomics.lua b/modpol_core/modules/tokenomics.lua index d9aa306..372fda7 100644 --- a/modpol_core/modules/tokenomics.lua +++ b/modpol_core/modules/tokenomics.lua @@ -1,6 +1,6 @@ ---- tokenomics --- @module tokenomics +--- Tokenomics. -- Depends on consent +-- @module tokenomics local tokenomics = { name = "Tokenomics", @@ -9,14 +9,11 @@ local tokenomics = { hide = true; } ---- (Required) Data for module --- Variables that module uses during the course of a process --- Can be blank tokenomics.data = { result = nil } ---- (Required): config for module +--- Config for module -- @field consent Require consent to create? -- @field token_variables the data that goes into the token -- @field token_slug A no-spaces slug for the token @@ -33,11 +30,11 @@ tokenomics.config = { } } ---- (Required): initiate function: creates a token in an org --- set up the token data structure --- create an org treasury +--- Initiate function: creates a token in an org. +-- Set up the token data structure. +-- Create an org treasury +-- @function tokenomics:initiate -- @param result (optional) Callback if this module is embedded in other modules --- @function initiate function tokenomics:initiate(result) -- TODO need to create a series of interactions to get the info from users self.data.result = result @@ -69,6 +66,8 @@ function tokenomics:initiate(result) end end +--- Create token +-- @function tokenomics:create_token function tokenomics:create_token() if not self.org.tokens then self.org.tokens = {} end self.org.tokens[self.config.token_slug] = @@ -89,8 +88,9 @@ end -- all need to write to persistent data -- amount can be positive or negative (except transfer) --- returns balance --- if no user, get treasury balance +--- Returns balance. +-- If no user, get treasury balance +-- @function tokenomics.balance -- @param org Name (string) or id (num) -- @param token Slug (string) -- @param user Name (string) @@ -112,8 +112,12 @@ function tokenomics.balance(org, token, user) end end +--- Change balance +-- @function tokenomics.change_balance -- @param org Org name (string) or id (number) -- @param token Token slug (string) +-- @param user +-- @param amount function tokenomics.change_balance(org, token, user, amount) local this_org = modpol.orgs.get_org(org) if not this_org then @@ -139,6 +143,12 @@ function tokenomics.change_balance(org, token, user, amount) end end +--- Transfer tokens from a sender to recipient +-- @function tokenomics.transfer +-- @param org +-- @param token +-- @param sender +-- @param recipient -- @param amount Positive number function tokenomics.transfer(org, token, sender, recipient, amount) local sender_balance = tokenomics.balance(org, token, sender) @@ -161,6 +171,11 @@ function tokenomics.transfer(org, token, sender, recipient, amount) end end +--- Transfer from treasury +-- @function tokenomics.treasury_transfer +-- @param org +-- @param token +-- @param recipient -- @param amount Can be positive or negative, assumes flow from treasury to recipient function tokenomics.treasury_transfer(org, token, recipient, amount) local this_org = modpol.orgs.get_org(org) @@ -189,7 +204,11 @@ function tokenomics.treasury_transfer(org, token, recipient, amount) end end --- creates new tokens in the org treasury +--- Creates new tokens in the org treasury +-- @function tokenomics.issue +-- @param org +-- @param token +-- @param amount function tokenomics.issue(org, token, amount) local this_org = modpol.orgs.get_org(org) if not this_org then @@ -209,5 +228,4 @@ end ------------------------------------------ ---- (Required) Add to module table modpol.modules.tokenomics = tokenomics diff --git a/modpol_core/orgs/process.lua b/modpol_core/orgs/process.lua index b20b280..aedaa36 100644 --- a/modpol_core/orgs/process.lua +++ b/modpol_core/orgs/process.lua @@ -55,7 +55,10 @@ function modpol.orgs:call_module(module_slug, initiator, config, result, parent_ return index end - +--- Get the root process of the given id +-- @function modpol.orgs.get_root_process +-- @param id +-- @return root process function modpol.orgs:get_root_process(id) local process = self.processes[id] while (process.parent_id) do @@ -64,6 +67,9 @@ function modpol.orgs:get_root_process(id) return process end +--- Delete the process given id +-- @function modpol.orgs.delete_process +-- @param id function modpol.orgs:delete_process(id) local process = self.processes[id] if process and process ~= "deleted" then diff --git a/modpol_minetest/overrides/interactions.lua b/modpol_minetest/overrides/interactions.lua index 69b3fe9..9bbca45 100644 --- a/modpol_minetest/overrides/interactions.lua +++ b/modpol_minetest/overrides/interactions.lua @@ -1,5 +1,4 @@ --- INTERACTIONS.LUA (for Minetest) - +--- INTERACTIONS.LUA (for Minetest) -- CONTEXTUAL STUFF -- ================