Posted 07 May 2013 - 10:38 PM
I am working on a button API. Currently, there is a function that I use the fill in a table with the coordinates of the button, the name, and the text that's on it and another function that creates a box using the coordinates from the table and the color as a parameter.
Code:
It is the function that creates the box that is giving me trouble. I keep getting this error:
Help is appreciated!
Thanks! :D/>
P.S. Sorry for some of the weird(or lack of) indentation. I just started using sublime and when I copy it from there to here the indentation gets messed up sometimes.
Code:
local button = {}
function fillTable(name, xmix, xmax, ymin, ymax, text)
button[name] = {}
button[name]["text"] = text
button[name]["xmix"] = xmin
button[name]["xmax"] = xmax
button[name]["ymin"] = ymin
button[name]["ymax"] = ymax
end
function createBox(name, color)
term.setBackgroundColor(color)
currentY = button[name]["ymin"]
while currentY ~= button[name]["ymax"] do
term.setCursorPos(button[name]["xmin"], currentY)
for i = 1,button[name]["xmax"] do
write(" ")
end
currentY = currentY +1
end
end
It is the function that creates the box that is giving me trouble. I keep getting this error:
btn:17: Expected number, number
When I look at line 17 I can't find anything wrong with it. Both of the coordinates should be numbers. If I change them from tables to just straight up numbers it works fine. It seems strange because everywhere else it works fine.Help is appreciated!
Thanks! :D/>
P.S. Sorry for some of the weird(or lack of) indentation. I just started using sublime and when I copy it from there to here the indentation gets messed up sometimes.