Page 1 of 1

How to access properties of a prototype in control.lua

Posted: Tue Feb 19, 2019 3:36 pm
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?

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

Posted: Tue Feb 19, 2019 4:36 pm
by eduran
https://lua-api.factorio.com/0.16.51/Lu ... prototypes

Code: Select all

game.entity_prototypes[<entity_name>][<property_name>]

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

Posted: Tue Feb 19, 2019 11:09 pm
by DaveMcW
game.entity_prototypes["boiler"].max_energy_usage

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

Posted: Wed Feb 20, 2019 4:22 pm
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