How to reference entries in data.raw? (locomotive)
Posted: Sat May 13, 2017 7:53 pm
Hello,
Currently I want to continue making some Factorio mods of minor complexity after having not made a Factorio mod for a year or so. Back then when I made my first small Factorio mods I used to manually copy the existing entries within the *.lua files in the folder "prototypes" and then make some changes to the properties.
This time I used the following tutorial to get back to modding: https://wiki.factorio.com/User:Gangsir/ ... e_creation
In the tutorial a "deepcopy" of an existing data-entry is assigned to a local variable. When trying to start Factorio using the newly created "mod" without real functionality, I am getting the following error:
So far my google searches using various search terms didn't get me any further.
It would be good, if some modder (or other user) on the forums could point me to the right direction like a current overview about how and where to access entries in data.raw .
Thanks in advance,
Krayt
Currently I want to continue making some Factorio mods of minor complexity after having not made a Factorio mod for a year or so. Back then when I made my first small Factorio mods I used to manually copy the existing entries within the *.lua files in the folder "prototypes" and then make some changes to the properties.
This time I used the following tutorial to get back to modding: https://wiki.factorio.com/User:Gangsir/ ... e_creation
In the tutorial a "deepcopy" of an existing data-entry is assigned to a local variable. When trying to start Factorio using the newly created "mod" without real functionality, I am getting the following error:
The source code of my mod's item.lua:Error loading mods wrote:Code: Select all
Failed to load mods: __ArmoredTrain__/data.lua:1: __ArmoredTrain__/prototypes/item.lua:3: attempt to index local 'armoredTrain' (a nil value)
item.lua
As far as I understand the situation is comparable to what would be a NullPointerException in Java. So I assume my reference to the "diesel-locomotive" in data.raw is not correct. That's why I can't access attributes of my local variable armoredTrain.So far my google searches using various search terms didn't get me any further.
It would be good, if some modder (or other user) on the forums could point me to the right direction like a current overview about how and where to access entries in data.raw .
Thanks in advance,
Krayt