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
} expectet but it is there
Re: } expectet but it is there
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
},
}},
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
},
}},
Re: } expectet but it is there
Use a better IDE
remove the comma line 26 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)" create a lua project
remove the comma line 26 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)" create a lua project
Re: } expectet but it is there
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
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
- thereaverofdarkness
- Filter Inserter
- Posts: 560
- Joined: Wed Jun 01, 2016 5:07 am
- Contact:
Re: } expectet but it is there
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.
- BlueTemplar
- Smart Inserter
- Posts: 3234
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: } expectet but it is there
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)