Module:Param Parse: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 456: Line 456:
}
}


local parts = {}
local _, profession, knowledge, quest, min_weapon_strength =
input:gmatch("(.-),(.-)%.-%s+(.-),%.-%s+(.-),%.-%s+(.-)")
for part in val:gmatch("%w+") do
table.insert(parts, part)

if not profession or not knowledge or not quest or not min_weapon_strength then
return "Invalid input"
end
end


local profession = {parts[1], parts[2]}
local profession_name, profession_value = profession:match("(%w+)%s+(%S+)")
local knowledge = parts[3]

local knowledge_value = knowledge
local quest = parts[4]
local quest_value = quest
local min_weapon_strength = parts[5]
local min_weapon_strength_value = min_weapon_strength

local result = {
icon_map[profession] .. " " .. profession_value,
icon_map.knowledge .. " " .. knowledge_value,
icon_map.quest .. " " .. quest_value,
icon_map["min_weapon_strength"] .. " " .. min_weapon_strength_value
}


return table.concat(result, ", ")
return string.format(
"%s %s, %s %s, %s %s, %s %s",
icon_map[profession[1]], profession[2],
icon_map.knowledge, knowledge,
icon_map.quest, quest,
icon_map.min_weapon_strength, min_weapon_strength
)
end
end