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

bios:206; [string "startup"]:6: '=' expected

Started by Backseat_dog, 18 March 2013 - 06:22 PM
Backseat_dog #1
Posted 18 March 2013 - 07:22 PM
I'm using this code from a youtube series and i fixed some of the problems but I keep running into the = expected problem. I have used all I know about lua and cc.

Code:

local tArgs = { ... }
       rednet.open("left")
if tArgs[1] == "read" then
    rednet.broadcast(tArgs[2])
a, messagep = rednet.receive(1)
else messagep == null then
elseif
print("You've Got Mail!")
print("-----------------------")
print(messagep)
end

      else if tArgs[1] == "send" then
rednet.broadcast("sendmail")
write("To: (in ID) ")
input = read()
rednet.broadcast(input)
else
      print("Usage:")
print("mail read (mail id)")
      print("mail send")
end
Edited by
Lyqyd #2
Posted 19 March 2013 - 03:40 AM
Split into new topic.
theoriginalbit #3
Posted 19 March 2013 - 03:42 AM
Line 6:

else messagep == null then

you have come from another programming language haven't you?

in Lua its nil not null

Line 7:

elseif


if, else, elseif … you have the else and elseif the wrong way around. elseif should be on line 6, else on line 7 … or maybe it should just be else, not too sure what you are wanting to do in those few lines.
Edited on 19 March 2013 - 02:46 AM
Kingdaro #4
Posted 19 March 2013 - 03:43 AM
The "else" on line 6 should be "elseif", and you should remove the "elseif" on the line afterwards.

Also, there's no "null". In lua, it's called nil.

EDIT: Ninja'd yet again.
theoriginalbit #5
Posted 19 March 2013 - 03:46 AM
Oh another one

Line 13

else if tArgs[1] == "send" then
elseif … one word