Module:Special

-- See Module:Special/doc for documentation 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 string.len(title) > 0 then result = result .. " " .. title .. " "	end -- Circular script that sets each stat to table cell while perk <= 7 do	   if tonumber(value[perk]) ~= nil then thisPerk = tonumber(value[perk]) else thisPerk = 0 end 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 maximum = mw.text.split(frame.args[4], ",")    -- 	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 title ~= "" then		result = result .. " " .. title .. " "	end    while perk <= 7 do        if tonumber(value[perk]) ~= nil then       	    thisPerk = tonumber(value[perk])       	else       	    thisPerk = 0 end if tonumber(value[perk]) ~= nil then perkMax = tonumber(maximum[perk]) else perkMax = 0 end if perkMax > thisPerk then perkArr = " &rarr; " else perkArr = " &larr; " end if modifier[perk] ~= nil and modifier[perk] ~= "" then if perkMax ~= 0 then perkString = thisPerk + tonumber(modifier[perk]) .. perkArr .. perkMax + tonumber(modifier[perk]) else perkString = thisPerk + tonumber(modifier[perk]) end result = result .. tooltip( perkString, statistics[perk] ) .. " "		else if perkMax ~= 0 then perkString = thisPerk .. perkArr .. perkMax else perkString = thisPerk end result = result .. perkString .. " "		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 string.len(tostring(frame.args[3])) end return p