Now I am getting really odd errors. After rearranging the code and restarting Minecraft (Yes I did save in my editor) the error still appears in line 28 even though the rectFill function is being called, not the rect function where the error is now.
Full code:
local col = term.setTextColor;
local bgc = term.setBackgroundColor;
local cpos = term.setCursorPos;
line = paintutils.drawLine;
pixel = paintutils.drawPixel;
function fillScreen(fillColor) --Fills the screen with color
bgc(fillColor);
term.clear();
end
function textPixel(x, y, bgColor, textColor, text) --Draws a pixel with a character inside
col(textColor);
bgc(bgColor);
cpos(x, y);
write(string.sub(text, 1, 1));
end
function rectFill(x1,y1,x2,y2,fillColor) --Draw filled in rectangle
for x = x1, x2 do
for y = y1, y2 do
pixel(x, y, fillColor)
end
end
end
function rect(x1, y1, x2, y2, fillColor) --Draw outline of a rectangle
line(x1, y1, x2, y1, fillColor); --LINE 28 WHERE THE ERROR IS NOW
line(x1, y2, x2, y2, fillColor); --Bottom
line(x1, y1, x1, y2, fillColor); --Left
line(x2, y1, x2, y2, fillColor); --Right
end
Code that calls stuff in the draw API:
local function login()
draw.fillScreen(colors.cyan);
draw.rectFill(10,6,42,13,colors.blue);
cpos(24,6);
col(colors.white);
print("LOGIN");
end