trainworld_computercraft/computer/20/display.lua
2025-06-01 02:23:34 +02:00

32 lines
No EOL
762 B
Lua

local display = peripheral.wrap("create_source_1")
local update_interval = 4
local messages = {
{ "Try the new MEGA MEGA STACK", "2x MEGA! 1$ only! - WOW" },
{ "Don't miss our opening day 50% off!" },
{ "The best vegan* fast food available", "Guaranteed less than 20% blood content" },
}
local message_index = 1
function update_display()
display.clear()
local top_row = messages[message_index][1]
local bottom_row = messages[message_index][2]
if top_row then
display.setCursorPos(1, 1)
display.write(top_row)
end
if bottom_row then
display.setCursorPos(1, 2)
display.write(bottom_row)
end
message_index = (message_index % #messages) + 1
end
function display_loop()
while true do
update_display()
sleep(update_interval)
end
end