cleaned up module template!

This commit is contained in:
Luke Miller 2021-12-16 13:32:30 -05:00
parent fa7a0f82f6
commit 826f9600b5
2 changed files with 18 additions and 18 deletions

View File

@ -2,22 +2,12 @@
-- Module that enables a user to join an org
JoinOrg = {}
JoinOrg_mt = { __index = JoinOrg }
function JoinOrg.create(initiator, org, id)
local inst = {
name = "Join an org",
desc = "Initiator chooses an org to become a member of. Nothing happens if they are already in an org.",
initiator = initiator,
org = org,
id = id,
votes_yes = 0
}
setmetatable(inst, JoinOrg_mt)
return inst
end
JoinOrg.setup = {
name = "Join an org",
desc = "Initiator chooses an org to become a member of. Nothing happens if they are already in an org.",
votes_yes = 0
}
function JoinOrg:initiate(result)
modpol.interactions.binary_poll_user(
@ -33,8 +23,6 @@ function JoinOrg:initiate(result)
end
)
if result then result() end
end

View File

@ -22,7 +22,19 @@ function modpol.orgs:call_module(module_name, initiator)
end
local module = modpol.modules[module_name]
local new_process = module.create(initiator, self, index)
local new_process = {
metatable = {__index = module},
initiator = initiator,
org = self,
id = index
}
for k, v in pairs(module.setup) do
new_process[k] = v
end
setmetatable(new_process, new_process.metatable)
self.processes[index] = new_process