Anonymous

Module:MoneyMakingGuide: Difference between revisions

From Melvor Idle
Add error display for invalid skill exp values
mNo edit summary
(Add error display for invalid skill exp values)
Line 145: Line 145:
for _, skillLine in pairs(skills) do
for _, skillLine in pairs(skills) do
local hasInvalidExp = false
local hasInvalidExp = false
local hasInvalidName = false
local span = mw.html.create('div')
local span = mw.html.create('div')
if skillLine.exp == nil or skillLine.exp == 0 then
if skillLine.exp == nil or skillLine.exp <= 0 then
hasInvalidExp = true
hasInvalidExp = true
end
end
local skillIcon = getSkillExpIcon(skillLine.name, skillLine.exp or 0)
local skillIcon = getSkillExpIcon(skillLine.name, skillLine.exp or 0)
 
if skillIcon == nil then
if hasInvalidExp then
hasInvalidName = true
span:css('color', 'red')
end
:wikitext('Skill in parameter ' .. skillLine.prmNumber .. " has an invalid experience value.")
if hasInvalidExp or hasInvalidName then
else
else
span:wikitext(skillIcon)
span:wikitext(skillIcon)
end
end
mw.log(skillIcon)
mw.log(skillLine.name)


table.insert(layoutLines, span)
table.insert(layoutLines, span)
Line 286: Line 280:
items = "",
items = "",
other = "",
other = "",
skillExp1 = "Magic",
skillExp1 = "Maagic",
skillExp1amount = "1000",
skillExp1amount = "-1000",
skillExp2 = "Mining",
skillExp2 = "Mining",
skillExp2amount = "420",
skillExp2amount = "420",
2,875

edits