Module:MoneyMakingGuide: Difference between revisions

Remove uppercase formatting for item names
m (Remove public test function)
(Remove uppercase formatting for item names)
Line 26: Line 26:
--return frame:preprocess(str)
--return frame:preprocess(str)
end
end
--- Formats a given string to TitleCase.
--- Formats a given string to TitleCase.
-- @param name (string) String to format.
-- @param name (string) String to format.
-- @return (string) Formatted string, or the input if it's not a string.
-- @return (string) Formatted string, or the input if it's not a string.
local function formatName(name)
local function formatItemName(name)
-- Special case to correctly format GP name.
-- Special case to correctly format GP name.
if shared.compareString(name, 'Gold Pieces', true) or shared.compareString(name, 'GP', true) then
if shared.compareString(name, 'Gold Pieces', true) or shared.compareString(name, 'GP', true) then
Line 35: Line 36:
end
end
-- Got to solve too many edge case swith this (like of and IV)
-- Better just make the user use the correct name instead.
--if type(name) == 'string' then
-- return shared.titleCase(name)
--end
return name
end
local function formatSkillName(name)
if type(name) == 'string' then
if type(name) == 'string' then
return shared.titleCase(name)
return shared.titleCase(name)
Line 82: Line 93:
end
end
local pName = formatName(args[numPrefix])
local pName = formatItemName(args[numPrefix])
local pAmount = args[numPrefix .. AmountSuffix]
local pAmount = args[numPrefix .. AmountSuffix]
local pValue = args[numPrefix .. ValueSuffix]
local pValue = args[numPrefix .. ValueSuffix]
Line 128: Line 139:
end
end
local pSkill = formatName(args[skillPrefix])
local pSkill = formatSkillName(args[skillPrefix])
local pExp = args[skillPrefix .. AmountSuffix]
local pExp = args[skillPrefix .. AmountSuffix]


1,029

edits