Error on closing parenthesis. Fixed

Place to get help with not working mods / modding interface.
Zuzak
Inserter
Inserter
Posts: 33
Joined: Sat Oct 04, 2014 6:09 pm
Contact:

Error on closing parenthesis. Fixed

Post by Zuzak »

edit: I fixed it, it seems that lua code is crazy sensitive to spacing and indent changes.

Why error on closing parenthesis saying its not there?
Why does factorio not read the last ) on some of my files?
It is there! I SEE it!
It seems to be entirely random to me
relevant bit of error message:
')' expected to close '(' at line 1 near '}"
or when I change order or closeness of final) :
unexpected symbol near }
?What is going on here??
contents of file:

Code: Select all

data:extend(
{
    {
    type = "recipe",
    name = "energy-shield-mkz-equipment",
    enabled = "false",
    energy_required = 12,
    ingredients =
    {
      {energy-shield-mk2-equipment, 3},
     },
    result = "energy-shield-mkz-equipment"
    },
}
)
Tell me what I'm missing please. It is driving me insane. This is not the only file that it does this, I use Notepad++, and the opening and closing parts of dataextend are copy-pasted from files that do work. I have reloaded, recopied, renamed, with comma, without comma, spacing;etc in different programs to 'fix' this issue, but nothing works.
I must be insane because I've been repeating myself in the hopes that it will work

Or am I just hallucinating that a closing parenthesis even exists in that copy-pasta from the file? That is the only plausible explanation I can come up with for why cannot the game read it. :shock:
I am unable to comprehend this.
I fixed it by copy pasting from below post and modifying.
somewhere in one of my other recipes, something fubared.
I compared the new, working file to the old with the compare plugin it seems that lua code is crazy sensitive to spacing and indent changes.
Last edited by Zuzak on Sat Nov 22, 2014 1:31 am, edited 3 times in total.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: Why error on closing parenthesis saying its not there?

Post by L0771 »

Code: Select all

data:extend(
{
    {
    type = "recipe",
    name = "energy-shield-mkz-equipment",
    enabled = "false",
    energy_required = 12,
    ingredients =
    {
      {"energy-shield-mk2-equipment", 3}, -- i only was added quotes
     },
    result = "energy-shield-mkz-equipment"
    },
}
)
i've changed ingredient and result and i can load perfectly(add quotes), but i haven't your problem
Zuzak
Inserter
Inserter
Posts: 33
Joined: Sat Oct 04, 2014 6:09 pm
Contact:

Re: Why error on closing parenthesis saying its not there?

Post by Zuzak »

somewhere in one of my other recipes, something fubared.
I compared the new, working file to the old with the compare plugin it seems that lua code is crazy sensitive to spacing and indent changes.

Thank you L0771

I'll leave this here for a example to others.
cartmen180
Filter Inserter
Filter Inserter
Posts: 358
Joined: Fri Jul 25, 2014 2:53 pm
Contact:

Re: Error on closing parenthesis. Fixed

Post by cartmen180 »

lua is not at all affected by spacing or indents. The only reason i use spacing is to make the code more readable, otherwise it would be one long line per file :p

the error is because of this:

Code: Select all

ingredients =
    {
      {energy-shield-mk2-equipment, 3},
     },
which should be:

Code: Select all

ingredients =
    {
      {"energy-shield-mk2-equipment", 3}
     },
Check out my mods
Post Reply

Return to “Modding help”