Module:Register table

From N64brew Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Register table/doc

local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.head( frame )
	local arr = {}
	for k,v in pairs(getArgs(frame)) do
		table.insert(arr, v)
	end
	
	return '{| class="wikitable" style="text-align: center; table-layout: fixed; width: '..arr[1]..';"\n! colspan="9" | '..arr[2]..'\n'
end

function p.row( frame )
	local arr = {}
	for k,v in pairs(getArgs(frame)) do
		table.insert(arr, v)
	end
	
	return '|- style="font-size: 85%; line-height: 0.9em; background-color: #caccd0;"\n! rowspan="2" style="font-size: 115%;" | '..arr[1]..'\n'
end

function p.foot( frame )
	return '|}'
end

function p.definitions( frame )
    local args = getArgs(frame)
	local s = '{| style="font-size: 85%; line-height: 1.6em;"\n'
	
	local arr = {}
	for k,v in pairs(args) do
		table.insert(arr, v)
	end
	
	for i = 1, #arr, 3 do
		s = s .. '|-\n| style="min-width: 54px; padding-right: 9px; vertical-align:top;" | bit ' .. arr[i] .. ' || \'\'\'' .. arr[i + 1] .. ':\'\'\' ' .. arr[i + 2] .. '\n'
	end
	
	s = s .. '|}'
	
	return s
end


function p.extra( frame )
	
end

return p