Module:Tasks

local p = {} local taskData = mw.loadData( 'Module:Tasks/data' )

function p.getData(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

local joint   = 0 local duration = tArgs[1] or "" if (tArgs[2] and tArgs[2] ~= "") then joint = 2 end local ipName  = tArgs[3] or "dmk"

ipName = string.lower(ipName) duration = string.lower(duration)

local ipTaskData = taskData[ipName] if not ipTaskData then ipTaskData = taskData[string.match(ipName, "(.+)grumpy")] if not ipTaskData then ipTaskData = taskData["dmk"] end end

if duration == "all" then return frame:preprocess( "|Various\n| nowrap|, "                               ) else if not ipTaskData[duration] then duration = "?h" end return frame:preprocess( "|" .. duration .. "\n| nowrap|"                               .. ipTaskData[duration][1 + joint]                                .. ", "                                .. ipTaskData[duration][2 + joint]                                ) end end return p