Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- TO EDIT THE MESSAGE, YOU WANT TO EDIT
- THE "message.txt" FILE!
- ]]--
- --settings
- local filename = "message.txt"
- local monitor_side = "back"
- function display()
- mon = peripheral.wrap(monitor_side)
- file = fs.open(filename, "r")
- s = file:readAll()
- file.close()
- local t = {}
- local i = 0
- table.insert(t, 0)
- while true do
- i = string.find(s, "\n", i+1)
- if i == nil then break end
- table.insert(t, i)
- end
- mon.clear()
- local h=0
- local x, _ = mon.getSize()
- for i = 1, (#t-1) do
- h=h+1
- mon.setCursorPos(1,h)
- local st = string.sub(s, t[i]+1, t[i+1])
- if(#st > x)then
- fst = string.sub(st, 1, x-1)
- sst = string.sub(st, x, string.len(st))
- mon.write(fst .. "-")
- h = h +1
- mon.setCursorPos(1,h)
- mon.write(sst)
- else
- mon.write(st)
- end
- end
- end
- while(true)do
- stat, err = pcall(display)
- --if(stat == true)then
- --break
- --end
- print(err)
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment