Home
Random
Log in
Settings
About the Deadlock Wiki
Search
Editing
Module
:
Sandbox/Samlovesmath/Infobox hero
Give feedback
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.
Anti-spam check. Do
not
fill this in!
local p = {}; local heroes_data = mw.loadJsonData("Data:HeroData.json") local theme_data = mw.loadJsonData("Data:Sandbox/Samlovesmath/Infobox_hero.json") local heroes_data_module = require('Module:HeroData') function p.hero_has_scalars(frame) local frameHero = frame.args[1] local frameStat = frame.args[2] local frame = mw.getCurrentFrame() newFrameSpirit = frame:newChild{title = "Module:HeroData", args = {frameHero, "Spirit", frameStat}} newFrameLevel = frame:newChild{title = "Module:HeroData", args = {frameHero, "Level", frameStat}} spiritResult = heroes_data_module.get_hero_scalar(newFrameSpirit) levelResult = heroes_data_module.get_hero_scalar(newFrameLevel) if (spiritResult ~= nil and spiritResult ~= "") or (levelResult ~= nil and levelResult ~= "") then return true end return false end function p.hero_has_tags(frame) local frame = mw.getCurrentFrame() newFrame = frame:newChild{title = "Module:HeroData", args = {frame.args[1], "1"} } if string.find(heroes_data_module.get_hero_tag(newFrame), 'Error:') == nil then return true end return false end function p.is_hero_key(frame) local hero_key = frame.args[1] for i,v in pairs(heroes_data) do if i == hero_key then return true end end return false end function p.en_is_hero_key(frame) local hero_en = frame.args[1] for i,v in pairs(heroes_data) do if v["Name"] ~= nil and string.lower(v["Name"]) == string.lower(hero_en) then return true end end return false end function p.get_theme_var(frame) local hero_key = frame.args[1] local theme_var = frame.args[2] if theme_data[hero_key] ~= nil and theme_data[hero_key][theme_var] ~= nil then return theme_data[hero_key][theme_var] elseif theme_data["hero_default"][theme_var] ~= nil then return theme_data["hero_default"][theme_var] end return nil end return p
Summary:
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
Page included on this page:
Module:Sandbox/Samlovesmath/Infobox hero/doc
(
view source
)