Module:LTEvent

--[[ LUA script to get Limited Time Event   Parameters:        1 = short name : Event / IP short name        2 = type       : event type                        N = normal limited time event (default)                        T = Tower Challenge                        M = Mini Event        3 = output     : output type                        default = Full Event Name                        T = Text Full Name                        S = Text Name only                        A = Alternate Text        4 = alt text   : alternate text

Unknown Event is returned if Event is not in data. ]]--

local p = {}

local lteData = mw.loadData( 'Module:LTEvent/data' )

function getArgs(frame) local tArgs

if frame == mw.getCurrentFrame then fParent = frame:getParent tArgs = fParent.args

if (fParent.args[1]) then tArgs = fParent.args else tArgs = frame.args end else tArgs = frame end return tArgs end

function p.getLTE(frame)

local tArgs = getArgs(frame)

local sName   = tArgs[1] or "" local eType   = tArgs[2] or "N" local outType = tArgs[3] or "" local altText = tArgs[4] or ""

sName = mw.ustring.gsub(mw.ustring.lower(sName),               "^%s*(.-)%s*$", "%1") or ''

eType = mw.ustring.upper(eType)

local outText = ""

local prefix = "" local suffix = " Event" local eName = "Work In Progress" local year  = nil if eType == "T" then prefix = "The Tower Challenge ("       suffix = ") Event" elseif eType == "M" then suffix = " Mini Event" end

if lteData[eType] and lteData[eType][sName] then eName = lteData[eType][sName][1] year = lteData[eType][sName][2] end

outText = "" .. prefix .. eName .. suffix   if year then        outText = outText .. " " .. year    end    outText = outText .. ""

return outText end

return p