Posted 06 September 2016 - 10:39 PM
Currently i'm trying to expand upon my code for a loading bar (by adding options such as color customization).
Currently i have it make a bar using the function Pr(x, y) x being the bar color and y being the outline box color
The issue is when i added in the box color option it give the "attempt to call table error"
here is the code
Currently i have it make a bar using the function Pr(x, y) x being the bar color and y being the outline box color
The issue is when i added in the box color option it give the "attempt to call table error"
here is the code
local function Cl()
term.clear()
term.setCursorPos(1, 1)
end
local function Cp(text)
local x2,y2 = term.getCursorPos()
local x,y = term.getSize()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
print(text)
end
local function Pr(x, y)
Cl()
startx = 4
endx = 48
ypos = 7
boxcolor = y
barcolor = x
stime = .5
paintutils.drawBox( 1, 1, 51, 19, colors(boxcolor))
for i=startx, endx do
paintutils.drawPixel(i, ypos, colors[barcolor])
sleep(stime)
end
end
Pr("red", "brown")
Cp("Done!")
sleep(2)