12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- --- module_template
- -- @module module_template
- --- (Required): data table containing name and description of the module
- -- @field name "Human-readable name"
- -- @field slug "Same as module class name"
- -- @field desc "Description of the module"
- local module_template = {
- name = "Module Human-Readable Name",
- slug = "template",
- desc = "Description of the module"
- }
- --- (Required) Data for module
- -- Variables that module uses during the course of a process
- -- Can be blank
- module_template.data = {
- }
- --- (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
- -- @field field_1 ex: votes_required, default = 5
- -- @field field_2 ex: voting_type, default = "majority"
- module_template.config = {
- field_1 = 5
- field_2 = "majority"
- }
- --- (Required): initiate function
- -- Modules have access to the following instance variables:
- -- <li><code>self.org</code> (the org the module was called in),</li>
- -- <li><code>self.initiator</code> (the user that callced the module),</li>
- -- <li><code>self.id</code> (the process id of the module instance)</li>
- -- @param config (optional) If user wants to override fields in the config table
- -- @param result (optional) Callback if this module is embedded in other modules
- -- @function initiate
- function module_template:initiate(config, result)
- -- call interaction functions here!
- -- call result function
- if result then result() end
- end
- --- (Required) Add to module table
- modpol.modules.module_template = module_template
|