Module:SkillParse

From Caves of Qud Wiki
Jump to navigation Jump to search
Template-info.png Documentation

Module to parse Skill strings from ObjectBlueprints. For example, converts "LongBlades" to "Long Blades" and "HeavyWeapons" to "Heavy Weapons".

Usage

{{#invoke: SkillParse | parse | (SkillName here) }}

Code:

{{#invoke: SkillParse | parse | LongBlades }}

Result:

Long Blades


local p = {}

function p.parse(frame)
  local skillString = frame.args[1]
  local prettyString = ""
  for w in string.gfind(skillString, "%u%l+") do
    if (string.len(prettyString) > 0) then
      prettyString = prettyString .. " "
    end
    prettyString = prettyString .. w
  end
  return prettyString
end

return p