Module:Tasks

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

function p.getData(frame) local tArgs = frame:getParent if not(tArgs.args[1]) then tArgs = frame end

local joint   = 0 local duration = tArgs.args[1] or "" if (tArgs.args[2] and tArgs.args[2] ~= "") then joint = 2 end local ipName  = tArgs.args[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