Module:Sandbox/GarDoomforge

local p = {}

local function tableToString(t) local key local value local result result = '' for key, value in pairs(t) do		if (tonumber(key) ~= nil) then result = result .. ':table[' .. key .. '] is ' .. value .. '\n' else result = result .. ':table[\'' .. key .. '\'] is ' .. value .. '\n' end end

return result end

function p.args(frame) return ';args\n' .. tableToString(frame.args) end

function p.callParserFunction(frame) return ';callParserFunction\n' .. frame:callParserFunction('#time', 'Y-m-d H:i:s') .. '\n' end

function p.extensionTag(frame) return ';extensionTag\n:' .. frame:extensionTag('nowiki', 'text', {}) .. '\n' end

p.getParent = function(frame) frame = frame:getParent return ';getParent\n' .. frame:getTitle .. '\n' end

function p.getTitle(frame) return ';getTitle\n:' .. frame:getTitle .. '\n' end

function p.getTitle1(frame) return mw.title.getCurrentTitle end

function p.getTitle2(frame) return ';mw.title.getCurrentTitle\n:' .. mw.title.getCurrentTitle.prefixedText .. '\n' end

function p.tableLibrary local numbers = {} local resukt math.randomseed(os.time) for i = 1, 10, 1 do		table.insert(numbers, math.random(1, 10)) end result = ';random numbers\n' result = result .. ':' .. table.concat(numbers, ', ') .. '\n' table.sort(numbers) result = result .. ';sorted numbers\n' result = result .. ':' .. table.concat(numbers, ', ') .. '\n'

table.remove(numbers, 1) result = result .. ';after removing the first value\n' result = result .. ':' .. table.concat(numbers, ', ') .. '\n'

table.sort(numbers, function(a, b) return a > b end) result = result .. ';sorted in descending order\n' result = result .. ':' .. table.concat(numbers, ', ') .. '\n' return result end

function p.osclock return ';clock\n:' .. os.clock .. '\n' end function p.osdate return ';date\n:' .. os.date .. '\n' end function p.osdifftime local t1 = {year = 2014, month = 1, day = 1, hour = 0, min = 0, sec = 0, isdst = false} local t2 = {year = 2014, month = 12, day = 31, hour = 23, min = 59, sec = 59, isdst = false} return ';difftime\n:' .. os.difftime(os.time(t2), os.time(t1)) .. '\n' end function p.ostime return ';time\n:' .. os.time .. '\n' end

return p