LuaItemPrototype.get_ammo_type() can be used with all item prototypes
LuaItemPrototype.get_ammo_type() can be used with all item prototypes
The description of LuaItemPrototype.get_ammo_type() contains the warning "Can only be used if this is AmmoItem". This isn't true: If you loop over game.item_prototypes and run get_ammo_type(), this will not throw an error for items that are not an AmmoItem, but return nil instead.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: LuaItemPrototype.get_ammo_type() can be used with all item prototypes
That's just how all prototype properties are. It's a flaw in the documentation generation system. Last time I asked, the answer was along the lines "not until I can make a general fix".Pi-C wrote: ↑Thu Jun 27, 2024 1:33 pmThe description of LuaItemPrototype.get_ammo_type() contains the warning "Can only be used if this is AmmoItem". This isn't true: If you loop over game.item_prototypes and run get_ammo_type(), this will not throw an error for items that are not an AmmoItem, but return nil instead.
Re: LuaItemPrototype.get_ammo_type() can be used with all item prototypes
OK, thanks for the info!
![Smile :-)](./images/smilies/icon_e_smile.gif)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!