Jump to content




Question about a program error


  • You cannot reply to this topic
2 replies to this topic

#1 Akirha

  • New Members
  • 2 posts

Posted 01 June 2014 - 02:35 AM

Hi, I'm new to Lua and computer craft but I have been programming for a long time. I recently had a major loss of vision because of diabetes and I just recently had surgery to reverse it. (Currently having someone proof read this). I'm using a magnifier right now to program computers and turtles in minecraft. I felt like explaining this because my question is a rather simple one but I have the most problems with it because of my vision.

Question: I'm getting an this error(bios:339: [string"rTable"]:9: ')' expected) whenever I run this code.


local id = nil
local packet = {["id"] = 1, ["name"] = "Bob", ["msg"] = "hi there"}
local msg = nil
while true do
  id, msg = rednet.receive(10)

  if id ~= nil and msg ~= nil then
	packet = textutils.unserialize(msg)
	print("id: "...packet.id)
	print("name: "...packet.name)
	print("msg: "....packet.msg)
	break
  end
end

I'm thinking it's a syntax error, but I wouldn't be here unless I was stumped. I apologize if this question is to trivial for the forum or answered somewhere else. If there is an answer to the problem in a post or in a tutorial please link, I would be more than happy to read it, I just have problems navigating around. Thank you :)

#2 Ajt86

  • Members
  • 42 posts

Posted 01 June 2014 - 06:07 AM

When you typed in
print("id: "...packet.id)	 -- 3 dots
print("name: "...packet.name)	 -- 3 dots
print("msg: "....packet.msg)	 -- 4 dots
instead of "..." you need to use ".." (only two dots) to concatenate string, like this:
print("id: "..packet.id)
print("name: "..packet.name)
print("msg: "..packet.msg)

Edited by Ajt86, 01 June 2014 - 06:08 AM.


#3 Akirha

  • New Members
  • 2 posts

Posted 01 June 2014 - 06:18 AM

And now I'll never forget that two dots concatenate. Thank you so much.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users