Figuring out data.raw types

Place to get help with not working mods / modding interface.
boss8989
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Dec 05, 2020 1:52 am
Contact:

Figuring out data.raw types

Post by boss8989 »

So im wondering if there is a easy way to find out the exact path/file names.

Like for example inserters are data.raw.inserter, is there somewhere that labels all of these?

I have looked at the data.raw page on the wiki but this doesnt seem to state the specific names, like the inserters are under quiet a few sub headings.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Figuring out data.raw types

Post by eradicator »

Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
boss8989
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Dec 05, 2020 1:52 am
Contact:

Re: Figuring out data.raw types

Post by boss8989 »

eradicator wrote: Mon Dec 07, 2020 12:24 am https://wiki.factorio.com/Data.raw
thanks but as I said in the post that doesnt specify the proper name, as the inserters actually come under several headers
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Figuring out data.raw types

Post by eradicator »

boss8989 wrote: Mon Dec 07, 2020 12:33 am as the inserters actually come under several headers
Uhm...no they don't? Each prototype is stored in a subtable that is named exactly by its respective prototype type. There are no exceptions.

Code: Select all

data.raw[type][name]
Maybe you should post a code example to better explain what you think you're seeing.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
boss8989
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Dec 05, 2020 1:52 am
Contact:

Re: Figuring out data.raw types

Post by boss8989 »

eradicator wrote: Mon Dec 07, 2020 1:04 am
boss8989 wrote: Mon Dec 07, 2020 12:33 am as the inserters actually come under several headers
Uhm...no they don't? Each prototype is stored in a subtable that is named exactly by its respective prototype type. There are no exceptions.

Code: Select all

data.raw[type][name]
Maybe you should post a code example to better explain what you think you're seeing.
If I search for inserter on that page its under several headers, as in items, corpse, explosion.

edit, I ah think I see what you mean, you click on the link at the top and it will take you to the correct area on that page.

Still having some issues though, say for example the arithmetic combinator, if I write it as I see it in that page it does not work "data.raw.arithmeticcombinator["arithmetic-combinator"]"
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Figuring out data.raw types

Post by eradicator »

boss8989 wrote: Mon Dec 07, 2020 1:17 am If I search for inserter on that page its under several headers, as in items, corpse, explosion.
Well, each "building" in the game usually needs at least a recipe to craft it, and an item to place it and the actual building. And then a corpse when the building is destroyed etc.

boss8989 wrote: Mon Dec 07, 2020 1:17 am Still having some issues though, say for example the arithmetic combinator, if I write it as I see it in that page it does not work "data.raw.arithmeticcombinator["arithmetic-combinator"]"
You can't just leave out the dash...

Code: Select all

data.raw["arithmetic-combinator"]["arithmetic-combinator"]
If a class ("type") has only one actual prototype ("building") then that prototype usually has the same name as the type, but ofc other mods can add differently named ones.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
boss8989
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Dec 05, 2020 1:52 am
Contact:

Re: Figuring out data.raw types

Post by boss8989 »

eradicator wrote: Mon Dec 07, 2020 1:41 am
boss8989 wrote: Mon Dec 07, 2020 1:17 am If I search for inserter on that page its under several headers, as in items, corpse, explosion.
Well, each "building" in the game usually needs at least a recipe to craft it, and an item to place it and the actual building. And then a corpse when the building is destroyed etc.

boss8989 wrote: Mon Dec 07, 2020 1:17 am Still having some issues though, say for example the arithmetic combinator, if I write it as I see it in that page it does not work "data.raw.arithmeticcombinator["arithmetic-combinator"]"
You can't just leave out the dash...

Code: Select all

data.raw["arithmetic-combinator"]["arithmetic-combinator"]
If a class ("type") has only one actual prototype ("building") then that prototype usually has the same name as the type, but ofc other mods can add differently named ones.
ok that makes sense thanks, the reason I left out the dash's is because the inserter does "data.raw.inserter["inserter"]
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Figuring out data.raw types

Post by eradicator »

boss8989 wrote: Mon Dec 07, 2020 1:51 am because the inserter does "data.raw.inserter["inserter"]
That's all really just syntactic sugar for

Code: Select all

data["raw"]["inserter"]["inserter"]
They're all just strings. Most lua tutorial should explain that.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Modding help”