cleaned up module template!
This commit is contained in:
parent
fa7a0f82f6
commit
826f9600b5
@ -2,22 +2,12 @@
|
|||||||
-- Module that enables a user to join an org
|
-- Module that enables a user to join an org
|
||||||
|
|
||||||
JoinOrg = {}
|
JoinOrg = {}
|
||||||
JoinOrg_mt = { __index = JoinOrg }
|
|
||||||
|
|
||||||
|
JoinOrg.setup = {
|
||||||
function JoinOrg.create(initiator, org, id)
|
name = "Join an org",
|
||||||
local inst = {
|
desc = "Initiator chooses an org to become a member of. Nothing happens if they are already in an org.",
|
||||||
name = "Join an org",
|
votes_yes = 0
|
||||||
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
|
|
||||||
|
|
||||||
function JoinOrg:initiate(result)
|
function JoinOrg:initiate(result)
|
||||||
modpol.interactions.binary_poll_user(
|
modpol.interactions.binary_poll_user(
|
||||||
@ -33,8 +23,6 @@ function JoinOrg:initiate(result)
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if result then result() end
|
if result then result() end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,19 @@ function modpol.orgs:call_module(module_name, initiator)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local module = modpol.modules[module_name]
|
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
|
self.processes[index] = new_process
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user