text.input ("Do sir want some drinks?")
variable = read()
if variable = ("yes") then
turtle.drop()
end
What am I f*cking up here?
bios:366: [string "turtle"]:3: 'then' excepted
Started by lare290, Dec 12 2014 09:52 PM
8 replies to this topic
#1
Posted 12 December 2014 - 09:52 PM
it says thing in title when I try to run this in turtle:
#2
Posted 12 December 2014 - 10:09 PM
Lua doesn't expect to see a variable assignment using = there, so it complains at you. == is used for "is equal" comparisons.
#3
Posted 12 December 2014 - 10:11 PM
now it says "bios:366: [string "turtle"]:2: '=' excepted
text.input ("Do sir want some drinks?")
variable == read()
if variable == ("yes") then
turtle.drop()
end
Edited by lare290, 12 December 2014 - 10:23 PM.
#5
Posted 12 December 2014 - 10:47 PM
So it didn't like text.input, i had to use write for it to work. why was that?
#6
Posted 12 December 2014 - 10:52 PM
To memory, I don't there is a text.input, at least, not unless you pre-defined one somewhere else.
#7
Posted 12 December 2014 - 11:08 PM
I saw text.input somewhere
#8
Posted 12 December 2014 - 11:34 PM
lare290, on 12 December 2014 - 10:11 PM, said:
now it says "bios:366: [string "turtle"]:2: '=' excepted
text.input ("Do sir want some drinks?")
variable == read()
if variable == ("yes") then
turtle.drop()
endif variable == "yes" thenso basically, drop the parenthesis on the if statement.
Edited by Geforce Fan, 12 December 2014 - 11:36 PM.
#9
Posted 13 December 2014 - 12:15 AM
print("Do sir want some drinks?")
variable = read()
if variable == ("yes") then
turtle.drop()
end
This should work. If you want to display text, use print/write/term.write
When setting a value, you need only one =
When checking if two values are the same, you need two =
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











