Advertisement
Guest User

graph

a guest
Jun 29th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. colors = {colors.green, colors.green, colors.lime, colors.lime, colors.yellow, colors.yellow, colors.orange, colors.orange, colors.red, colors.red}
  2.  
  3. function drawGraph(gVar, x, y)
  4.   termX, termY = term.getSize()
  5.  
  6.   if x < 1 then
  7.     x = 1
  8.   elseif x > termX - 2 then
  9.     x = termX - 2
  10.   end
  11.  
  12.   if y < 10 then
  13.     y = 10
  14.   elseif y > termY then
  15.     y = termY
  16.   end
  17.    
  18.   if gVar > 10 then
  19.     gVar = 10
  20.   end
  21.  
  22.   for i = 1, gVar do
  23.     y = y - 1
  24.     term.setCursorPos(x, y)
  25.     term.setBackgroundColor(colors[i])
  26.     term.write("  ")
  27.   end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement