From 0b265d7be5bff69095b1dfeea789ddea1dac222f Mon Sep 17 00:00:00 2001 From: Skylar Hew Date: Thu, 16 Dec 2021 14:07:58 -0700 Subject: [PATCH] Added ldoc comments and slug variable for setup --- modpol/modules/template.lua | 48 ++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/modpol/modules/template.lua b/modpol/modules/template.lua index 52144ec..7a3fbc6 100644 --- a/modpol/modules/template.lua +++ b/modpol/modules/template.lua @@ -1,29 +1,39 @@ +--- Template for modules +-- function initiate and table setup are required as a base. +-- @module Template +Template = {} - -Module = {} - -Module.setup = { - name = "Module Name", +--- (Required): setup table containing name and description of the module +-- @field name "Module Human-Readable Name" +-- @field slug "Template" same as module name +-- @field desc "Description of the module" +Template.setup = { + name = "Module Human-Readable Name", + slug = "Template", desc = "Description of the module" } --- defines the input parameters to the module initiate function --- when calling a module from within another module --- variables not defined in config will be ignored --- default values set in config can be overridden -Module.config = { - votes_required = 5 - voting_type = "majority" +--- (Optional): config for module +-- Defines the input parameters to the module initiate function. +-- 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" +Template.config = { + field_1 = 5 + field_2 = "majority" } --- 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) - -function Module:initiate(config, 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)
  • +-- @function initiate +function Template:initiate(config, result) -- call interaction functions here! -- call result function if result then result() end -end \ No newline at end of file +end