Jump to content

Module:Sandbox/Ahecht

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 00:44, 15 April 2020 (test). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
function p.main(frame)
	local output = {}
	output[1] = 'frame: ' .. type(frame) .. ' '
	if frame[1] then
		output[2] = frame[1]
	else
		output[2] = ''
	end
	output[3] = '\<br />frame.args: ' .. type(frame.args) .. ' '
	if frame.args[1] then
		output[4] = frame.args[1]
	else
		output[4] = ''
	end
	output[5] = '<br />frame:getParent().args ' .. type(frame:getParent().args) .. ' '
	if frame:getParent().args[1] then
		output[6] = frame:getParent().args[1]
	else
		output[6] = ''
	end
	if frame.args['test'] == 0 then
		output[7] = '<br />0 the number'
	elseif frame.args['test'] == '0' then
		output[7] = '<br />0 the character'
	else
		output[7] = ''
	end
	
	return table.concat(output)
end

function p.rows2data(frame)
	args = frame.args
	output = {}
	for k,v in ipairs(args) do
		output[k] = v
	end
	for k,v in pairs(args) do
		if (type(k) == 'string') and (k ~= 'divisor') and (k ~= 'numwidth') and (k ~= 'collapsible') then
			output[#output+1] = k .. '=' .. v
		end
	end
	
	return table.concat(output,';') .. '\n'
end

return p