dev
Documentation icon Module documentation
[create]

The documentation for this module is missing. Click here to create it.

a = { 1, 2, nil, 4 }
mw.log( #a )

local ret = {}
local fooBarData = mw.loadData('Module:Sandbox/ZFEsper/FooBar/data')
local getArgs = require('Module:Arguments').getArgs

function ret.showargs( frame )
	local out_list = {}
	local out_add = function ( value )
		-- mw.log (value)
		table.insert(out_list, value)
	end

	local objarg = frame.args
	-- local objarg = getArgs(frame)
	mw.log(#frame, ',', #objarg)
	mw.logObject(frame)
	mw.logObject(objarg)

	out_add('frame #: ' .. #frame)
	out_add('.args #: ' .. #objarg)
	out_add('.type #: ' .. type(objarg))
	out_add('    -------------------')
	for key,value in pairs(objarg) do
		-- mw.log('    >', key, ':', value)
		out_add('    > ' .. key .. '(' .. type(key) .. ')' .. ' : ' .. value)
	end
	out_add('    -------------------')

	if objarg[1] ~= nil then out_add('arg 1: ' .. objarg[1]) end
	if objarg[2] ~= nil then out_add('arg 2: ' .. objarg[2]) end
	if objarg[3] ~= nil then out_add('arg 3: ' .. objarg[3]) end

	local quit = ''
	for _,line in ipairs(out_list) do
		-- mw.log ('line:', line)
		quit = quit .. "\n<br>||| " .. line
	end
	return quit
end

function ret.tmpl( frame )
	-- mw.log('qqqqqtt')
	local fooBarText = frame.args[1]
	return fooBarData[fooBarText] or fooBarText or "n/a"
end

return ret