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 p.table(frame) local value = mw.text.split(frame.args[1], ",")     -- Splits the values into an array local modifier = mw.text.split(frame.args[2], ",")  -- Splits the modifiers into an array local title = frame.args[3]                                    -- If a game title is declared, this will be transfered to a variable 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" or tostring(title) ~= "'" then result = result .. " ''" .. tostring(title) .. "'' "	end

-- 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 p.string(frame) local value = mw.text.split(frame.args[1], ",")     -- Splits the values into an array local modifier = mw.text.split(frame.args[2], ",")  -- Splits the modifiers into an array local title = frame.args[3]                                    -- If a game title is declared, this will be transfered to a variable 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" or tostring(title) ~= "'" then result = result .. " ''" .. tostring(title) .. "'' "	end

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 result = result .. " "       return result end

function p.test(frame) return frame.args[3] end

return p