diff --git a/modpol/orgs/orgs.lua b/modpol/orgs/orgs.lua index bc78cd1..f00ffe7 100644 --- a/modpol/orgs/orgs.lua +++ b/modpol/orgs/orgs.lua @@ -9,16 +9,17 @@ modpol.orgs.__index = modpol.orgs -- ================================================== -- returns org when given its id or name -function modpol.orgs.get_org(id) - if type(id) == 'string' then +function modpol.orgs.get_org(arg) + if type(arg) == 'string' then for id, org in ipairs(modpol.orgs.array) do - if org.name == id then + if org.name == arg then return org end end - elseif type(id) == 'number' then - return modpol.orgs.array[id] + elseif type(arg) == 'number' then + return modpol.orgs.array[arg] end + return nil end -- ===============================================