Advertisement
LDDestroier

lddbuff api (wip af)

Jan 23rd, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. local blits = "0123456789abcdef"
  2.  
  3.  
  4. lddbuff = {
  5.     bg = colors.black,
  6.     txt = colors.white,
  7.     buffer = {
  8.         char = {},
  9.         txt = {},
  10.         bg = {},
  11.     },
  12.     term = {
  13.         native = term.native(),
  14.         write = function(text)
  15.            
  16.         end,
  17.         --add more
  18.     },
  19.     io = {
  20.         write = function(text)
  21.            
  22.         end,
  23.         --add more
  24.     }
  25. }
  26.  
  27. updateScreenSize = function()
  28.     local scr_x,scr_y = term.getSize()
  29.     for y = #lddbuff.buffer.char, 1, -1 do
  30.         if y > scr_y then
  31.             table.remove(lddbuff.buffer.char,y)
  32.             table.remove(lddbuff.buffer.txt,y)
  33.             table.remove(lddbuff.buffer.bg,y)
  34.         elseif y > #lddbuff.buffer.char then
  35.             lddbuff.buffer.char[y] = (" "):rep(scr_x)
  36.             lddbuff.buffer.txt[y] = ("0"):rep(scr_x)
  37.             lddbuff.buffer.bg[y] = ("f"):rep(scr_x)
  38.         else
  39.             for x = #lddbuff.buffer.char[y], scr_x do
  40.                 lddbuff.buffer.char = lddbuff.buffer.char.." "
  41.                 lddbuff.buffer.txt = lddbuff.buffer.txt..lddbuff.buffer.txt:sub(-1)
  42.                 lddbuff.buffer.bg = lddbuff.buffer.txt..lddbuff.buffer.txt:sub(-1)
  43.             end
  44.         end
  45.     end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement