This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Wochilly's profile picture

"'then' expected" error, then in plain sight[SOLVED]

Started by Wochilly, 18 November 2016 - 10:42 AM
Wochilly #1
Posted 18 November 2016 - 11:42 AM
So I was testing out the second part of my startup program, and this showed up
bios.lua:14: [string ".temp"]:8: 'then' expected
here's the program:
os.loadAPI(Basics)
paintutils.drawQuestionBox()–this is from the Basics API, this didn't cause the error
textutils.slowPrint("Your name?")
term.setCursorPos(5, 8)
term.setBackgroundColor( colors.white )
local name = read()
term.clear()
if name = Wochilly then –this caused the error
paintutils.drawDialog()–yet again, another function from the API
textutils.slowPrint("Wochilly! Welcome back!")
term.setBackgroundColor( colors.black )
term.setTextColor( colors.lightBlue )
term.clear()
term.setCursorPos(1, 1)
print("CraftOS Binary Edition")\
else
print("TODO")
end
If you're curious, here's the Basics API:
function paintutils.drawDialog()
paintutils.drawFilledBox(1, 15, 51, 19, colors.blue )
paintutils.drawFilledBox(2, 16, 50, 18, colors.lightBlue )
term.setCursorPos(2, 16)
term.setBackgroundColor( colors.lightBlue )
end
function paintutils.drawQuestionBox()
paintutils.drawFilledBox(3, 5, 47, 10, colors.yellow )
paintutils.drawLine(5, 8, 45, 8, colors.white )
term.setBackgroundColor( colors.yellow )
term.setTextColor( colors.black )
term.setCursorPos(5,7)
end
So apparently the error is saying the 8th line which checks if the name is Wochilly or not is expected to have a 'then' even though then is in plain sight.
Can anyone help me?
Edit:No, changing the = to == won't work. it will just say "expected string" and yes, i've tried putting "" on the Wochilly
ReEdit:Apparently the expected string was caused due to me loading the API incorrectly. I've fixed it now, so ignore this post.
Edited on 19 November 2016 - 12:26 AM
Lyqyd #2
Posted 18 November 2016 - 05:41 PM
My favorite sticky post can help!
Creator #3
Posted 18 November 2016 - 10:24 PM
On line 14 you put = instead of ==. And yes, do read the sticky posts before posting.