Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --]] Ascii Utils, By Redxone [[--
- -- ]] Drawing Utils
- function loadAscii(file)
- if(fs.exists(file))then
- f = fs.open(file,"r")
- canv = textutils.unserialize(f.readAll())
- f.close()
- if(type(canv) == "table")then
- return canv
- else
- error("Ascii -> LoadAscii[ERROR], Invalid file format. (Not an Ascii)")
- end
- else
- error("Ascii -> LoadAscii[ERROR], No such file.")
- end
- end
- function drawAscii(art,x,y)
- local w,h = term.getSize()
- if(type(art) == "table")then
- for yy = 0, h-1 do
- for xx = 0, w-1 do
- if(art[yy][xx].char ~= "\127")then
- term.setCursorPos(xx+x,yy+y)
- term.setTextColor(tonumber(art[yy][xx].color))
- write(tostring(art[yy][xx].char))
- end
- end
- end
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- else
- error("Ascii -> drawAscii[ERROR], Invalid art format. (Not an Ascii)")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement