[1.1.107] LuaSurface.create_entity docs missing stack property

Place to report issues and suggest improvements to the API documentation.
Post Reply
Danielv123
Inserter
Inserter
Posts: 48
Joined: Sun Jan 03, 2016 10:28 am
Contact:

[1.1.107] LuaSurface.create_entity docs missing stack property

Post by Danielv123 »

Attempting to create an item-on-ground with LuaSurface.create_entity without providing the stack parameter results in an error.

https://lua-api.factorio.com/latest/cla ... ate_entity

The stack property works fine, however it is not documented that it is accepted by the function.

/c game.player.surface.create_entity{name = "item-on-ground", position = game.player.position}

Error: Key "stack" not found in property tree

/c game.player.surface.create_entity{name = "item-on-ground", position = game.player.position, stack = "blueprint"} works sucessfully. I assume it accepts a SimpleItemStack.

Danielv123
Inserter
Inserter
Posts: 48
Joined: Sun Jan 03, 2016 10:28 am
Contact:

Re: [1.1.107] LuaSurface.create_entity docs missing stack property

Post by Danielv123 »

I see now that this is supposed to go in viewforum.php?f=233 - sorry about that

Pi-C
Smart Inserter
Smart Inserter
Posts: 1654
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [1.1.107] LuaSurface.create_entity docs missing stack property

Post by Pi-C »

Danielv123 wrote:
Mon Apr 15, 2024 9:00 pm
Attempting to create an item-on-ground with LuaSurface.create_entity without providing the stack parameter results in an error.

https://lua-api.factorio.com/latest/cla ... ate_entity

The stack property works fine, however it is not documented that it is accepted by the function.
"item-on-ground" is an "item-entity" prototype. If you look closely, right below the table "Parameters", after the sentence "Other attributes may be specified depending on the type of entity:", you'll find this note about item-entities:
Screenshot at 2024-04-16 06-27-58.png
Screenshot at 2024-04-16 06-27-58.png (216.9 KiB) Viewed 144 times
So the info already is available, but it's easy to miss the optional, type-based parameters after the first table. For example, I recently had to search the forum because I couldn't figure out how to create a character-corpse with >0 item slots. I eventually found an answer to a question about exactly the same issue that pointed out the type-specific parameters (fun fact: I've also posted the original question some years ago).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Documentation Improvement Requests”