Page 1 of 1

Error: '}' expected (to close '{' at line 3) near = (solved)

Posted: Sat Nov 19, 2016 10:56 pm
by guldakh
Hello, I am new to modding in factorio. I was testing my first mod and got this error. I am trying to make a nuclear cannon that shoots a missile to anywhere in the map. I tried to fix it but i couldn't find anywhere what was causing the error. The error occurred in the entity.lua file

When opening factorio it shows __Nuclearcannon__/prototypes/entity.lua:21: '}' expected (to close '{' at line 3)

Here is the code:

data:extend{
(
{
type = "electric-turret",
name = "Nuclear-cannon",
icon = "__Nuclearcannon__/graphics/entity/nuclearcannon.png",
flags = {"player-creation", "placeable-neutral"},
minable = {hardness = 0.2, mining_time = 3, result = "Nuclear-cannon"},
max_health = Health.Tier8,
resistances = Resistances.Tier6,
corpse = "medium-remnants",
selection_box = {{-1.2, -1,2}, {1.2, 1.2}},
collision_box = {{-0.7, -0,7}, {0.7, 0.7}},
vehicle_impact_sound = {filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65},
rotation_speed = 0.5,
preparing_speed = 0.75,
folding_speed = 0.25,
dying_explosion = "big-explosion",
inventory_size = 1,
automated_ammo_count = 5,
energy-source =
{
type = "electric",
buffer_capacity = "500kJ",
emmisions = 0.067 / 1.5,
usage_priority = "secondary-input",
},
energy_usage = "1,5mW"
}
}
)

Re: Error: '}' expected (to close '{' at line 3) near =

Posted: Sat Nov 19, 2016 11:05 pm
by skratic
it looks like you need to start with a parenthesis data:extend ( { {

Re: Error: '}' expected (to close '{' at line 3) near =

Posted: Sat Nov 19, 2016 11:07 pm
by guldakh
Nope, I just tried it and it won't work

Re: Error: '}' expected (to close '{' at line 3) near =

Posted: Sat Nov 19, 2016 11:19 pm
by daniel34
guldakh wrote:

Code: Select all

energy_usage = "1,5mW"
It should be 1.5 MW, with a dot, not a comma:

Code: Select all

energy_usage = "1.5 MW"
Also, skratic is right, you did start the code with the wrong parentheses.

Re: Error: '}' expected (to close '{' at line 3) near =

Posted: Sun Nov 20, 2016 10:05 am
by guldakh
I meant i tried it changing the order of the parenthesis and it didn't work but for the other thing thanks

Re: Error: '}' expected (to close '{' at line 3) near =

Posted: Sun Nov 20, 2016 10:39 am
by prg
energy-source should be energy_source.

Re: Error: '}' expected (to close '{' at line 3) near =

Posted: Sun Nov 20, 2016 10:54 am
by guldakh
Thanks to you all because i solved it :D