Mod syntax error, can't figure out why

Place to get help with not working mods / modding interface.
Post Reply
jupiter878
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 19, 2016 8:15 am
Contact:

Mod syntax error, can't figure out why

Post by jupiter878 »

I've been trying to make a mod that can modify the rocket animation speed so that it's easier to get neat ratios between it and other science setups. The game continues to throw messages that I have made a syntax error near the '-', but I don't know how to fix it, or why I've messed up.

data.raw.rocket-silo['rocket-silo'].light_blinking_speed = 1/(120)

data.raw.rocket-silo['rocket-silo'].door_opening_speed = 1/(151)

These two are the only lines in the data.lua file that I've created. I have attached both the data.lua and info.json files. I would appreciate some help with this.
Attachments
info.json
(561 Bytes) Downloaded 72 times
data.lua
(135 Bytes) Downloaded 75 times

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Mod syntax error, can't figure out why

Post by DaveMcW »

You correctly quoted the second dash but forgot the first.

data.raw['rocket-silo']['rocket-silo']

jupiter878
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 19, 2016 8:15 am
Contact:

Re: Mod syntax error, can't figure out why

Post by jupiter878 »

It works now, thanks.
Say, is there more than one type of syntax that works for this? I made another mod with the form

data.raw.boiler['heat-exchanger'].target_temperature = 515
data.raw.generator['steam-turbine'].maximum_temperature = 515

and this worked just fine, so I'd like to know what's allowed and not allowed here.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Mod syntax error, can't figure out why

Post by Nexela »

- is a special character in lua, to use it as a key it needs to be quoted

a.one is the same as a['one']

but

a.two-three has a special character in the key string so it has to be quoted otherwise it tries to subtract a.two and the (possibly nil) variable three. a['two-three']

Post Reply

Return to “Modding help”