Prototype vs Lua Class documentation

Place to get help with not working mods / modding interface.
Post Reply
User avatar
PumpkinVision
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Feb 15, 2020 10:46 pm
Contact:

Prototype vs Lua Class documentation

Post by PumpkinVision »

Prototype/Technology is documented here: https://wiki.factorio.com/Prototype/Technology
A "unit" property is documented, and an example is given.
It's possible to configure ingrideients, qtys per cycle, number of cycles, and time per cycle.

The Factorio Lua class LuaTechnology is documented here: https://lua-api.factorio.com/latest/Lua ... Technology
The Factorio Lua class LuaTechnologyPrototype is documented here: https://lua-api.factorio.com/latest/Lua ... otype.html
Neither has a "unit" property documented.
Both classes seem to have different properties (other than "unit") for identifying ingredients (research_unit_ingredients, research unit_count).
There doesn't seem a way to specify the time each processing of lab ingredients should take.

What is the difference between the Prototype and the classes?
Are the classes the C++ side of the Lua/C++ interface?
The documentation I've seen, succeeded in using, and also the vanilla raw data file all indicate I should be using "unit" to define technology ingredients, including time.
To what extent, if any, should I use the Lua class documentation when I just want to add more items to the game, similar to existing ones, using Lua?
Should I just follow the prototype documentation?

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 492
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Prototype vs Lua Class documentation

Post by Silari »

The wiki documents how prototypes are laid out during the data stage, inside data.raw. The other site is how the game lays out data in the LUA interface used during the runtime stage, while a game is in progress. The LUA api doesn't always use the same name for things as the data stage. This is specified at the top of the main page of lua-api.factorio.com
The settings stage is used to set up mod configuration options. The mod settings are documented on the wiki: Tutorial:Mod settings
The data stage is used to set up the prototypes of everything in the game. The prototypes are documented on the wiki: Prototype definitions
The third stage is runtime scripting. The classes and events used in this phase are documented here on this website.

If you're working with data.lua, use the prototype stuff on the wiki.

If you're working with control.lua, use the stuff on lua-api.

User avatar
PumpkinVision
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Feb 15, 2020 10:46 pm
Contact:

Re: Prototype vs Lua Class documentation

Post by PumpkinVision »

Thank you!

Post Reply

Return to “Modding help”