Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Text wrap w/ newline testing
- local w,h = term.getSize()
- local preprocess = "This is a thingy with derp because derpy took a crap in his toilet and forgot to flush^thanks to his mommy"
- local BUFFER = {}
- local add = ""
- for i = 1,preprocess:len() do
- if string.sub(preprocess,i,i) == "^" then
- table.insert(BUFFER,add)
- add = ""
- else
- add = add .. string.sub(preprocess,i,i)
- end
- if add:len() == w or i == preprocess:len() then
- table.insert(BUFFER,add)
- add = ""
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- for i = 1,#BUFFER do
- term.setCursorPos(1,i)
- term.write(BUFFER[i])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement