Brick_LuaLogic/bricks/outputs/pixel-update.lua
2020-05-19 02:22:30 -05:00

14 lines
329 B
Lua

return function(gate)
if gate.ports[1]:isrising() then
gate.tickStarted = gate:gettick()
elseif gate.ports[1]:isfalling() then
local ticksOn = gate:gettick() - gate.tickStarted
local colorid = ((ticksOn-1) % 8)
local colorname = string.reverse(tobitstring(colorid, 3))
gate:cb(colorname)
end
end