AliquotMesozoic

KISS Button API (Compressed)

Jul 7th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local t=term; local scp=t.setCursorPos; local tX,tY = t.getSize(); function cPP(te,x1,x2,y) scp(((x2-x1)/2+x1)-(#te/2),y)
  2. t.write(te) end button={b={}; n=function(s,d) s.b[#s.b+1]=d end;d=function(s)for i=1,#s.b do local b=s.b[i]
  3. for k=0,b.h-1 do t.setBackgroundColor(b.c) scp(b.x,b.y+k) t.write(string.rep(" ",#b.t+4)) end
  4. cPP(b.t,b.x+2,b.x+#b.t+3,(b.y+(b.h/2))) end end; cc=function(s,x,y) for k=1,#s.b do local b=s.b[k] if
  5. (x>=b.x and x<=(b.x+#b.t+3) and y>=b.y and y<=b.y+b.h-1) then return b end end end;}
Advertisement
Add Comment
Please, Sign In to add comment