Page 1 of 1

[RESOLVED] data.raw help?...

Posted: Tue Jul 11, 2017 9:23 pm
by Volvith

Code: Select all

data.raw["transport-belt"]["express-transport-belt"]["belt_horizontal"].hr_version.filename = "__TTL__/graphics/entity/fast/transport-belt/hr-fast-transport-belt.png"
This is pretty much me trying, and failing, to overwrite the high resolution sprites of express transport belts.
Error on startup: "Failed to load mods: __TTL__"/data-updates.lua:55: attempt to index field "hr_version' (a nil value)"
If anyone know the proper phrasing for the hr_version graphics, help plz! :3
Full Error Code

Re: data.raw help?...

Posted: Tue Jul 11, 2017 10:21 pm
by keyboardhack
The problem is with this line:

Code: Select all

data.raw["transport-belt"]["express-transport-belt"]["ending_patch"].hr_version.filename = "__TTL__/graphics/entity/fast/transport-belt/hr-fast-transport-belt.png"
Because the code for the table ending_patch looks like this:

Code: Select all

{
	sheet =
	{
		filename = "__base__/graphics/entity/transport-belt/start-end-integration-patches.png",
		width = 40,
		height = 40,
		priority = "extra-high",
		hr_version =
		{
			filename = "__base__/graphics/entity/transport-belt/hr-start-end-integration-patches.png",
			width = 80,
			height = 80,
			priority = "extra-high",
			scale = 0.5
		}
	}
}
So you have to access the hr_version filename like this:

Code: Select all

                                                                    ------
data.raw["transport-belt"]["express-transport-belt"]["ending_patch"].sheet.hr_version.filename = "__TTL__/graphics/entity/fast/transport-belt/hr-fast-transport-belt.png"
Lines shows the change to the code.

Re: data.raw help?...

Posted: Tue Jul 11, 2017 10:35 pm
by Volvith
keyboardhack wrote:
Collapsed quote.
Damn, that explains a lot... :/
I completely forgot to even check the demo-pics for the belts.

Anyhow, injected the .sheet into the line, boom, works like a charm.
Thanks a lot man, saved me a good while of stumbling around with my eyes closed there!... :D