fixed bug where getting org by name wouldn't work
This commit is contained in:
parent
4abee2e603
commit
ce56ec3fd6
@ -9,16 +9,17 @@ modpol.orgs.__index = modpol.orgs
|
|||||||
|
|
||||||
-- ==================================================
|
-- ==================================================
|
||||||
-- returns org when given its id or name
|
-- returns org when given its id or name
|
||||||
function modpol.orgs.get_org(id)
|
function modpol.orgs.get_org(arg)
|
||||||
if type(id) == 'string' then
|
if type(arg) == 'string' then
|
||||||
for id, org in ipairs(modpol.orgs.array) do
|
for id, org in ipairs(modpol.orgs.array) do
|
||||||
if org.name == id then
|
if org.name == arg then
|
||||||
return org
|
return org
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif type(id) == 'number' then
|
elseif type(arg) == 'number' then
|
||||||
return modpol.orgs.array[id]
|
return modpol.orgs.array[arg]
|
||||||
end
|
end
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ===============================================
|
-- ===============================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user