Jump to content




[Lua][Error]Sorry again, I got a new problem


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

#1 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 10 March 2013 - 09:35 PM

Well as the title says, I got a Error: bios:338: [string "DynationOS"]:19: '}' expected (to close '{' at line 17)
the weird thing is, is it is closed... can someone help me out by fixing it? Don't worry, I didn't make you guys have to hunt for the section I need help in, the full program is not even close to being finished and already 150 lines.
Spoiler


#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 10 March 2013 - 09:39 PM

each entry in a table must be separated by a comma. you have not done this. so fix that and you should be good.

EDIT: Well actually idk what you're doing there

is it meant to be this
local handle = fs.open("Account","r")
local user = handle.readLine()
or is it meant to be this
local user = {}
user["file"] = fs.open("Account","r")
user["user"] = user.file.readLine()


#3 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 10 March 2013 - 09:49 PM

It's meant to be this:
local user = 
  { 
    file = fs.open("Account","r"),
    user = file:readLine()
  }  
Note the comma.

#4 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 10 March 2013 - 09:50 PM

View PostTheOriginalBIT, on 10 March 2013 - 09:39 PM, said:

each entry in a table must be separated by a comma. you have not done this. so fix that and you should be good.

EDIT: Well actually idk what you're doing there

is it meant to be this
local handle = fs.open("Account","r")
local user = handle.readLine()
or is it meant to be this
local user = {}
user["file"] = fs.open("Account","r")
user["user"] = user.file.readLine()
Lol well I didn't want to post the ENTIRE program code, but what that function does it allows you to login... so I was trying to call the users information from one file to the main program.
EDIT: I put the commas in, it didn't give me a error, but it didn't work correctly... I probably need to fix the account file..

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 10 March 2013 - 09:50 PM

View Postimmibis, on 10 March 2013 - 09:49 PM, said:

It's meant to be this:
local user =
  {
	file = fs.open("Account","r"),
	user = file:readLine()
  }  
Note the comma.
Could that not cause problems considering you are trying to reference a table element while constructing the second element?

#6 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 10 March 2013 - 09:52 PM

View PostTheOriginalBIT, on 10 March 2013 - 09:50 PM, said:

View Postimmibis, on 10 March 2013 - 09:49 PM, said:

It's meant to be this:
local user =
  {
	file = fs.open("Account","r"),
	user = file:readLine()
  }  
Note the comma.
Could that not cause problems considering you are trying to reference a table element while constructing the second element?
Oh - yeah, that won't work.
It's also file.readLine not file:readLine
io uses :, fs uses .

And in your code, user["file"] and user["user"] can be replaced by user.file and user.user

#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 10 March 2013 - 09:57 PM

View Postimmibis, on 10 March 2013 - 09:52 PM, said:

And in your code, user["file"] and user["user"] can be replaced by user.file and user.user
I've found it doesn't always work for me, but either way, using . notation is just syntactical sugar, its not functionally any different.

#8 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 10 March 2013 - 10:01 PM

If one of you thinks they can help way more by seeing the entire code PM me, since it still doesn't work as I want it too.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users