Module:Sandbox

local p = {}

function p.outputItemList(frame) local data = mw.text.jsonDecode(mw.text.decode(frame.args['1'])) local itemList = "" for k, item in pairs(data) do       itemList = itemList .. item['link'] itemList = itemList .. '\n' end return itemList end

function isEmpty(s) return s == nil or s == '' end

local function getArgs(frame) local args = {} for key, value in pairs(frame:getParent.args) do       args[key] = value end for key, value in pairs(frame.args) do       args[key] = value end return args end

function p.main(frame) local args     = getArgs(frame) local seconds  = args[1] or args.seconds or '' return p.timeFormat(seconds) end

function p.timeFormat(seconds) local hours = seconds / 3600 local minutes = (seconds % 3600) / 60 local secs = (seconds % 3600) % 60 local print = "" if hours > 0 then print = print .. hours .. " hour" if hours > 1 then print = print .. "s" end if minutes > 0 then print = print .. ", " .. minutes .. " minute" if minutes > 1 then print = print .. "s" end if secs > 0 then print = print .. ", and " .. secs .. " second" if secs > 1 then print = print .. "s" end end elseif secs > 0 then print = print .. " and " .. secs .. " second" if secs > 1 then print = print .. "s" end end elseif minutes > 0 then print = print .. minutes .. " minute" if minutes > 1 then print = print .. "s" end if secs > 0 then print = print .. " and " .. secs .. " second" if secs > 1 then print = print .. "s" end end elseif secs > 0 then print = print .. secs .. " second" if secs > 1 then print = print .. "s" end end return print end return p