Module:MoneyMakingGuide: Difference between revisions

Add formatting of user input
m (Minor fixes)
(Add formatting of user input)
Line 30: Line 30:
-- @return (string) The HTML representation of the item table section.
-- @return (string) The HTML representation of the item table section.
local function buildExpTable(skills)
local function buildExpTable(skills)
end
--- Formats a given string to TitleCase.
-- @param name (string) String to format.
-- @return (string) Formatted string, or the input if it's not a string.
local function formatName(name)
if type(name) == 'string' then
return shared.titleCase(name)
end
return name
end
end


Line 46: Line 57:
end
end
local pName = args[numPrefix] -- Guaranteed to have a value.
local pName = formatName(args[numPrefix])
local pAmount = args[numPrefix .. AmountSuffix]
local pAmount = args[numPrefix .. AmountSuffix]
local pValue = args[numPrefix .. ValueSuffix]
local pValue = args[numPrefix .. ValueSuffix]
Line 84: Line 95:
end
end
local pSkill = args[skillPrefix] -- Guaranteed to have a value.
local pSkill = formatName(args[skillPrefix])
local pExp = args[skillPrefix .. AmountSuffix]
local pExp = args[skillPrefix .. AmountSuffix]


Line 99: Line 110:
return skills
return skills
end
end


--- Formats a wikicode string to be bold and red
--- Formats a wikicode string to be bold and red
1,010

edits