Index field error

Place to get help with not working mods / modding interface.
BAndrisHuN
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu Jun 30, 2016 10:08 pm
Contact:

Index field error

Post by BAndrisHuN »

The game gives me this error at line 1
attempt to index field 'global' (a nil value)
I am trying to configure in game settings for my mod, but i have to create a string from the number inputted with MJ concatenated to it.
I have the setting type as an int and runtime-global.

Code: Select all

EV = settings.global["epic_robot_energy-Multi"].value
data.raw["logistic-robot"]["logistic-robot"].max_energy = (tostring(EV) .. "MJ")
data.raw["construction-robot"]["construction-robot"].max_energy = (tostring(EV) .. "MJ")
Any help?
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Index field error

Post by Bilka »

You need to use the startup setting type for th setting to be available in the data phase: https://wiki.factorio.com/Tutorial:Mod_ ... e_property
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
BAndrisHuN
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu Jun 30, 2016 10:08 pm
Contact:

Re: Index field error

Post by BAndrisHuN »

OMG I thought about changing that but i was like why would it help, so i didn't.
Thank you, works like a charm now.
https://mods.factorio.com/mods/BAndrisH ... bot_energy
Post Reply

Return to “Modding help”