Skip to content

Instantly share code, notes, and snippets.

@canassa
Created July 8, 2015 07:51
Show Gist options
  • Save canassa/ce6ecaea2ce144f5123b to your computer and use it in GitHub Desktop.
Save canassa/ce6ecaea2ce144f5123b to your computer and use it in GitHub Desktop.
local display = {
{1, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0}
}
local COLUMN_SIDES = {
"front",
"front",
"left",
"left",
"back",
"back",
"top",
"top",
"right",
"right",
"bottom",
"bottom"
}
function print_column(column_number, data)
local side = COLUMN_SIDES[column_number]
local current = redstone.getBundledOutput(side)
local row_value = data[1] + bit.blshift(data[2], 1) + bit.blshift(data[3], 2) + bit.blshift(data[4], 3) + bit.blshift(data[5], 4) + bit.blshift(data[6], 5) + bit.blshift(data[7], 6) + bit.blshift(data[8], 7)
if column_number % 2 ~= 0 then
-- odd / impar
row_value = row_value + bit.band(current, 0xff00)
else
-- even / par
row_value = bit.band(current, 0x00ff) + bit.blshift(row_value, 8)
end
redstone.setBundledOutput(side, row_value)
end
print_column(1, display[1])
print_column(2, display[2])
print_column(3, display[3])
print_column(4, display[4])
print_column(5, display[5])
print_column(6, display[6])
print_column(7, display[7])
print_column(8, display[8])
print_column(9, display[9])
print_column(10, display[10])
print_column(11, display[11])
print_column(12, display[12])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment