Page 1 of 1

Index field error

Posted: Sat Dec 16, 2017 8:09 pm
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?

Re: Index field error

Posted: Sat Dec 16, 2017 8:15 pm
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

Re: Index field error

Posted: Sat Dec 16, 2017 8:19 pm
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