Descriptions:
LuaEntity.get_output_inventory()[1].valid is always true, even though there is actually no item in the first slot.
Steps to reproduce:
1) Download the attached mod. It is a simple mod just for reproducing this bug.
2) Start a new game.
3) Put a Wooden Chest on the ground. Notice "Item invalid" message should be shown. No error is shown because I added an if statement to check whether the inventory is empty.
4) Put something in its first slot. Notice "Item valid" and the item name should be shown.
5) Put another thing in its second slot. The same messages should still be shown.
6) Take out the item in the first slot. Error will be shown as below:
It complains that I should not access item.name whenever item is invalid. Unfortunately, item.valid failed to show the fact.
Expectation:
I expected either LuaEntity.get_output_inventory()[1] is nil or its.valid is false if there is no item in the entity's first slot.
[0.13.15] LuaItemStack.valid always returns true
Re: [0.13.15] LuaItemStack.valid always returns true
It doesn't always return valid. It returns valid if the entity that owns the item stack is still valid.
See: http://lua-api.factorio.com/latest/LuaI ... d_for_read
See: http://lua-api.factorio.com/latest/LuaI ... d_for_read
If you want to get ahold of me I'm almost always on Discord.
Re: [0.13.15] LuaItemStack.valid always returns true
Oh, sorry, I completely missed that. I am so used to the .valid property and haven't thought of other properties.
Thanks for the info. It is working now.

Thanks for the info. It is working now.