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

if ipName then ipName = string.lower(ipName) end

local ipTaskData = taskData[ipName] if not ipTaskData then ipTaskData = taskData["dmk"] end

if not ipTaskData[duration] then duration = "?h" end

return frame:preprocess( "|" .. duration .. "\n| nowrap|"                           .. ipTaskData[duration][1 + joint]                            .. ", "                            .. ipTaskData[duration][2 + joint]                            ) end return p