Module:Sandbox/LVL: Difference between revisions

LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
Switched to compact versions of scaling templates
Line 263: Line 263:
-- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank
-- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank
-- Scaling string meaning the expanded template {{Ss|scalar}} or {{Ls|scalar}}
-- Scaling string meaning the expanded template {{Ss|scalar}} or {{Ls|scalar}}
function p.write_scalar_str(scaling_value, scaling_type)
function p.write_scalar_str(scaling_value, scaling_type, compact)
local scaling_abbrevs = {Spirit = "Ss", Level = "PI"}
local scaling_abbrevs = {Spirit = "Ss", Level = "PI"}
Line 276: Line 276:
local template_args = {}
local template_args = {}
template_args["1"] = scaling_value
template_args["1"] = scaling_value
if compact then template_args["compact"] = "yes" end
local template_call = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
local template_call = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
Line 445: Line 446:
if (scaling_data ~= nil) then
if (scaling_data ~= nil) then
    for scaling_val, scaling_type in pairs(scaling_data) do
    for scaling_val, scaling_type in pairs(scaling_data) do
        local scaling_str = p.write_scalar_str(scaling_val, scaling_type)
        local scaling_str = p.write_scalar_str(scaling_val, scaling_type, true)
        if (scaling_str ~= "") then scaling_str = " " .. scaling_str end
        if (scaling_str ~= "") then scaling_str = " " .. scaling_str end
        if (scaling_str ~= nil) then
        if (scaling_str ~= nil) then