Jump to content

Module:Sandbox/Jbzdarkid/NecroTable

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Jbzdarkid (talk | contribs) at 01:34, 19 February 2023 (Created page with 'local p = {} function p.table(frame) local output = '<table cellpadding="0" style="margin:0px; border:1px; border-color:black; border-collapse:collapse; background-color:lightgray; text-align:center"><tr>' for j = 1, #frame.args['grid'] do local chr = str:byte(j) if (chr == string.byte(" ")) then row = row .. '<td></td>' end if (chr == string.byte("^")) then row = row .. '<td style="background-color:skyblue;">↑</td>' end if (chr == string.byte(...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.table(frame)
	local output = '<table cellpadding="0" style="margin:0px; border:1px; border-color:black; border-collapse:collapse; background-color:lightgray; text-align:center"><tr>'
	for j = 1, #frame.args['grid'] do
		local chr = str:byte(j)
		if (chr == string.byte(" ")) then row = row .. '<td></td>' end
		if (chr == string.byte("^")) then row = row .. '<td style="background-color:skyblue;">↑</td>' end
		if (chr == string.byte("v")) then row = row .. '<td style="background-color:skyblue;">↓</td>' end
		if (chr == string.byte("<")) then row = row .. '<td style="background-color:skyblue;">←</td>' end
		if (chr == string.byte(">")) then row = row .. '<td style="background-color:skyblue;">→</td>' end
		if (chr == string.byte("\n")) then row = row .. '</tr><tr>' end
		if (chr >= string.byte("1") and chr <= string.byte("9")) then
			local ord = chr - string.byte("0")
			row = row .. '<td style="background-color:' .. frame.args['color-' .. ord] .. '">[[File:' .. frame.args['image-' .. ord] .. '|24x24px]]</td>'
		end
	end
	output = output .. '</tr></table>'
	return output
end

return p