Module:Constants: Difference between revisions

Moved p.getModifierText to p._getModifierText and added a version designed to be directly called from wiki pages
(Added p.getSkillID)
(Moved p.getModifierText to p._getModifierText and added a version designed to be directly called from wiki pages)
Line 202: Line 202:
end
end


 
function p._getModifierText(modifier, value, doColor)
function p.getModifierText(modifier, value, doColor)
   if doColor == nil then doColor = true end
   if doColor == nil then doColor = true end
   local template = modifierTypes[modifier]
   local template = modifierTypes[modifier]
Line 254: Line 253:


   return result
   return result
end
function p.getModifierText(frame)
  local modifier = frame.args ~= nil and frame.args[1] or frame[1]
  local value = frame.args ~= nil and frame.args[2] or frame[2]
  local skill = frame.args ~= nil and frame.args.skill or frame.skill
  local doColor = frame.args ~= nil and frame.args[3] or frame[3]
  if doColor ~= nil then
    doColor = strupper(doColor) ~= 'FALSE'
  end
  if skill ~= nil then
    value = {p.getSkillID(skill), value}
  end
  return p._getModifierText(modifier, value, doColor)
end
end


return p
return p