Module:Sandbox/Jbzdarkid/NecroTable
Appearance
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>'
local grid = frame.args['grid']
for j = 1, #grid do
local chr = grid:byte(j)
if (chr == string.byte(" ")) then output = output .. '<td></td>' end
if (chr == string.byte("^")) then output = output .. '<td style="background-color:skyblue;">↑</td>' end
if (chr == string.byte("v")) then output = output .. '<td style="background-color:skyblue;">↓</td>' end
if (chr == string.byte("<")) then output = output .. '<td style="background-color:skyblue;">←</td>' end
if (chr == string.byte(">")) then output = output .. '<td style="background-color:skyblue;">→</td>' end
if (chr == string.byte("\n")) then output = output .. '</tr><tr>' end
if (chr >= string.byte("1") and chr <= string.byte("9")) then
local ord = chr - string.byte("0")
output = output .. '<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