Editing Module:Abilities/card

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 10: Line 10:


function get_hero_key(hero_name)
function get_hero_key(hero_name)
if hero_name == nil then return nil end
if not hero_name or hero_name == "" then return nil end
 
-- if name starts with "hero_", use it directly as the key
-- if name starts with "hero_", use it directly as the key
if string.sub(hero_name, 1, 5) == "hero_" then return hero_name end
if string.sub(hero_name, 1, 5) == "hero_" then return hero_name end
 
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")
return resource_lookup[hero_name:lower()].key
if not resource_lookup then return nil end
 
local key = tostring(hero_name):lower()
local entry = resource_lookup[key]
 
if not entry then
return nil
end
 
return entry.key
end
end


Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template