} expectet but it is there

Place to get help with not working mods / modding interface.
Post Reply
coolian
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Sep 08, 2018 10:15 pm
Contact:

} expectet but it is there

Post by coolian »

i am trying to leanrn how i can make a mod for factorio i have made an armor for which i want to make a research now the code i am using for that is this:
data:extend({
{
type = "technology",
name = "firearmor",
icon = "__FireArmor__/graphics/tech/r.png",
icon_size = 16,
effects =
{
{
type = "unlock-recipe",
recipe = "fire-armor"
},
},
prerequisites = {"military-2"},
unit =
{
count = 194,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 2},
{"military-science-pack", 1}
},
time = 1
},
}}),

notepad++ tells me all { are closed and i see it the same way but factorio tells me that at the last line (26) theres an } missing to close the { at line 1 how can i get the error togo away

Bary
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri May 19, 2017 12:43 pm
Contact:

Re: } expectet but it is there

Post by Bary »

Try like that, i'm not great in lua, but in my code there isn't round bracket after data:extend

data:extend{
{
type = "technology",
name = "firearmor",
icon = "__FireArmor__/graphics/tech/r.png",
icon_size = 16,
effects =
{
{
type = "unlock-recipe",
recipe = "fire-armor"
},
},
prerequisites = {"military-2"},
unit =
{
count = 194,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 2},
{"military-science-pack", 1}
},
time = 1
},
}},

Helfima
Fast Inserter
Fast Inserter
Posts: 199
Joined: Tue Jun 28, 2016 11:40 am
Contact:

Re: } expectet but it is there

Post by Helfima »

Use a better IDE
remove the comma line 26
bug-coolian.PNG
bug-coolian.PNG (56.17 KiB) Viewed 1348 times
me I use eclipse with lua plugin
after lauch eclipe, go help->install new software
search lua after selected work with "Eclipse LDT Update Site (stable)"
eclipse-lua.PNG
eclipse-lua.PNG (16.53 KiB) Viewed 1348 times
create a lua project :lol:

Hiladdar
Fast Inserter
Fast Inserter
Posts: 214
Joined: Mon May 14, 2018 6:47 pm
Contact:

Re: } expectet but it is there

Post by Hiladdar »

Bottom line up front, I think there is extra stuff in your code, (extra commas on line 12 and 25) causing the problem. Without the rest of the module, it is nearly impossible to verify if that is the correct or the only fix required.

I like the Helfima's recommendation of using a program editor which is capable of some debugging within the editor. Personally I am old school, and if a text editor has line count to the left side that is enough for me.

data:extend({
{
type = "technology",
name = "firearmor",
icon = "__FireArmor__/graphics/tech/r.png",
icon_size = 16,
effects =
{
{
type = "unlock-recipe",
recipe = "fire-armor"
} -- Line 12
},
prerequisites = {"military-2"},
unit =
{
count = 194,
ingredients =
{
{"science-pack-1", 1},
{"science-pack-2", 2},
{"military-science-pack", 1}
},
time = 1
} -- Line 25
}
})

Pasting the code from an editor into the window does not correctly paste the indentation used within the code and makes it much more difficult to read, especially where the line numbers are not included.

Hiladdar

User avatar
thereaverofdarkness
Filter Inserter
Filter Inserter
Posts: 558
Joined: Wed Jun 01, 2016 5:07 am
Contact:

Re: } expectet but it is there

Post by thereaverofdarkness »

Those syntax error messages are incorrect approximately 100% of the time. At best, they just tell you which line has the error. It's up to you to find it from there, and fixing it probably won't involve whatever the error message said it expects to find.

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 2420
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: } expectet but it is there

Post by BlueTemplar »

Hiladdar wrote:
Sun Mar 24, 2019 9:57 pm
Pasting the code from an editor into the window does not correctly paste the indentation used within the code and makes it much more difficult to read, especially where the line numbers are not included.
That's why there's the code tag :

Code: Select all

data:extend({
  {
    type = "technology",
    name = "firearmor",
    icon = "__FireArmor__/graphics/tech/r.png",
    icon_size = 16,
    effects =
    {
      {
        type = "unlock-recipe",
        recipe = "fire-armor"
      }                                             -- Line 12
    },
    prerequisites = {"military-2"},
    unit =
    {
      count = 194,
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 2},
        {"military-science-pack", 1}
      },
      time = 1
    }                                                -- Line 25
  }
})
BobDiggity (mod-scenario-pack)

Post Reply

Return to “Modding help”