Advertisement
Guest User

graph

a guest
Jun 29th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. color = {colors.red, colors.red, colors.orange, colors.orange, colors.yellow, colors.yellow, colors.lime, colors.lime, colors.green, colors.green}
  2.  
  3. function drawGraph(gVar, x, y)
  4.   termX, termY = term.getSize()
  5.   gVar = tonumber(math.ceil(gVar))
  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(color[i])
  26.     term.setTextColor(color[i])
  27.     term.write("==")
  28.   end
  29.   term.setBackgroundColor(colors.black)
  30.   term.setTextColor(colors.white)
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement