Module:Special

p = {}

local statistics = { [1] = "Strength", [2] = "Perception", [3] = "Endurance", [4] = "Charisma", [5] = "Intelligence", [6] = "Agility", [7] = "Luck" }

local links = { [1] = "ST", [2] = "PE", [3] = "EN", [4] = "CH", [5] = "IN", [6] = "AG", [7] = "LK" }

function tooltip(value, text) return '' .. value .. ' ' end

function tabular(value, modifier, perk) result = "" -- Circular script that sets each stat to table cell while perk <= table.getn(value) do		if perk == 1 then result = result .. ' "	return result end

function string(value, modifier, perk) result = "" while perk <= table.getn(value) do      	if modifier[perk] ~= nil and modifier[perk] ~= "" then result = result .. tooltip( tonumber(value[perk]) + tonumber(modifier[perk]), statistics[perk] ) .. " "		else result = result .. value[perk] end result = result .. links[perk] if perk <7 then result = result .. ", "		end perk = perk + 1 end return result end

function p.special(frame) local value = mw.text.split(frame.args[1], frame.args[2])     -- Splits the values into an array local modifier = mw.text.split(frame.args[3], frame.args[2])  -- Splits the modifiers into an array local title = frame.args[4]                                    -- If a game title is declared, this will be transfered to a variable local style = frame.args[5] -- Checks which function to call local perk = 1                                                -- Used for readings the arrays local result = " "                  -- Wrapper shell for SPECIAL stats to allow additional CSS handling -- Adds the game title if one has been denoted, otherwise nothing is added. if title ~= nil or tostring(title) ~= "nil" then result = result .. " " .. tostring(title) .. " "	end -- Checks for styling, users may want to display as table or inline in content if style[1] == "table" then table = tabular(value, modifier, perk) result = result .. table else stringResult = string(value, modifier, perk) result = result .. stringResult end result = result .. " " end

return p