How to access properties of a prototype in control.lua

Place to get help with not working mods / modding interface.
Post Reply
EthanKing
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Feb 19, 2019 3:05 pm
Contact:

How to access properties of a prototype in control.lua

Post by EthanKing »

I'm making my first mod recently, and I need to access properties of a prototype which is not listed in the properties of a LuaEntityPrototype.

For example, I need too know the energy_consumption of a boiler (seehttps://wiki.factorio.com/Prototype/Boiler), but data.raw["boiler"]["boiler"]["energy_consumption"] is unavailable in control.lua. What should I do?

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: How to access properties of a prototype in control.lua

Post by eduran »

https://lua-api.factorio.com/0.16.51/Lu ... prototypes

Code: Select all

game.entity_prototypes[<entity_name>][<property_name>]
Last edited by eduran on Wed Feb 20, 2019 6:16 am, edited 1 time in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to access properties of a prototype in control.lua

Post by DaveMcW »

game.entity_prototypes["boiler"].max_energy_usage

Helfima
Fast Inserter
Fast Inserter
Posts: 199
Joined: Tue Jun 28, 2016 11:40 am
Contact:

Re: How to access properties of a prototype in control.lua

Post by Helfima »

me I do a lua module, it s better when something change in API

https://github.com/Helfima/helmod/blob/ ... e.lua#L105

Post Reply

Return to “Modding help”