LuaBurner.currently_burning allows writing string too

Place to report issues and suggest improvements to the API documentation.
User avatar
Penguin_Spy
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Feb 26, 2017 3:09 am
Contact:

LuaBurner.currently_burning allows writing string too

Post by Penguin_Spy »

For LuaBurner.currently_burning, the type is indicated as read/write LuaItemPrototype. This is true, but the field also allows writing just the string of the item prototype's name. Note that the type is not ItemPrototypeIdentification, as that would allow writing a LuaItemStack too which LuaBurner.currently_burning does not allow.

Both of the following lines work (when hovering over a locomotive for example):

Code: Select all

game.player.selected.burner.currently_burning = game.item_prototypes["nuclear-fuel"]

game.player.selected.burner.currently_burning = "coal"
but this does not work (errors with "Error: Given object is not lua item prototype.")

Code: Select all

-- note: first slot of inventory is coal. this is just an easy way to get a LuaItemStack
item_stack = game.player.get_inventory(1)[1]
game.player.selected.burner.currently_burning = item_stack
I exist.
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 418
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: LuaBurner.currently_burning allows writing string too

Post by Stringweasel »

Another little note, it's possible to set `currently_burning` to any fuel, regardless of the burner's fuel category.
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
Post Reply

Return to “Documentation Improvement Requests”