I can't figure out wtf is wrong with my code and I need help.
I'm probably just making a noob mistake, but could someone help me out?
while (side==nil) do
term.clear()
term.setCursorPos(1,1)
term.write("Center Text Program, made by ColbiesTheName.")
term.setCursorPos(1,3)
term.write("Enter the side your monitor is touching this computer.")
term.setCursorPos(1,4)
term.write("(top, bottom, left, right, back, front)")
side = read()
os.sleep(0.5)
end
while (text==nil) do --The error is happening on this line.
term.clear()
term.setCursorPos(1,1)
term.write("Center Text Program made by ColbiesTheName.")
term.setCursorPos(1,3)
term.write("Please enter the text you would like to be written.")
text = read()
os.sleep(0.5)
end
local function centerText(text)
mon = peripheral.wrap(side)
if (mon == nil) do
term.clear()
term.setCursorPos(1,1)
term.write("Incorrect side! Please restart this program.")
os.sleep(10)
else do
sizex,sizey = mon.getScale()
textlength = text.len()
writex = math.floor(((sizex / 2) - (textlength / 2)))
writey = math.floor(((sizey / 2) - 1))
mon.setCursorPos(writex,writey)
mon.write(text)
end
end
It says "bios:14: [string "centerText"]:28: 'then' expected" and I have no idea why. There shouldn't be a need for a 'then' at line 14 (I marked where it is in the code.)