Posted 05 July 2014 - 12:24 AM
Okay so this is my code:
here is the drawBox function:
Here is the printC function:
this is only a small part of it, but the error is:
Can't see the problem, and I am not even using the Window API….:/
It gets to the drawing part and sets up the background colour then stops….
function errorLogging()
cs()
drawBox(1, 51, 1, 1, " ", tc, bc)
printC(">> Error Logging for DHD Program <<", 1, true, tc, bc)
print("> This will display the most recent errors that the")
print(" program has picked up on and logged!")
term.setCursorPos(1,4)
errorDatabase = db.load(errorLog)
for _, v in ipairs(errorDataBase) do
print(v)
end
drawBox(1, 51, 19, 1, " ", tc, bc)
printC(">> 'B' = Back <<", 19, false, tc, bc)
end
here is the drawBox function:
function drawBox(StartX, lengthX, StartY, lengthY, Text, Color, BkgColor) -- does what is says on the tin.
local x, y = term.getSize()
if Color then setCol(Color, BkgColor) end
if not Text then Text = "*" end
lengthX = lengthX - 1
lengthY = lengthY - 1
EndX = StartX + lengthX
EndY = StartY + lengthY
term.setCursorPos(StartX, StartY)
term.write(string.rep(Text, lengthX))
term.setCursorPos(StartX, EndY)
term.write(string.rep(Text, lengthX))
for i = StartY, EndY do
term.setCursorPos(StartX, i)
term.write(Text)
term.setCursorPos(EndX, i)
term.write(Text)
end
resetCol(Color, BkgColor)
return true
end
Here is the printC function:
function printC(Text, Line, NextLine, Color, BkgColor) -- print centered
local x, y = term.getSize()
x = x/2 - #Text/2
term.setCursorPos(x, Line)
if Color then setCol(Color, BkgColor) end
term.write(Text)
if NextLine then
term.setCursorPos(1, NextLine)
end
if Color then resetCol(Color, BkgColor) end
return true
end
this is only a small part of it, but the error is:
window:248: bad argument: double expected, got boolean
Can't see the problem, and I am not even using the Window API….:/
It gets to the drawing part and sets up the background colour then stops….