Page 1 of 1

Bug: Reading entity_label from Spidertron in Chest

Posted: Fri Sep 13, 2024 11:05 pm
by cal12345
Description:
There seems to be an issue with reading the entity_label of a Spidertron when stored inside a chest. When attempting to access the label through scripting, the entity_label property behaves inconsistently, returning either an empty string for unnamed Spidertrons or nil for named ones.

This bug was observed during attempts to access the Spidertron label using:

local label = stack.label or "no label"
local entity_label = stack.entity_label or "no entity label"
local name = stack.name or "no entity label"
item_flow.add{type="label", caption = "Label: " .. label}
item_flow.add{type="label", caption = "Entity Label: " .. entity_label}
item_flow.add{type="label", caption = "Name: " .. name}

Here is a summary of the behavior:
When the Spidertron is unnamed, an empty string ("") is returned.
When the Spidertron is named, nil is returned instead of the expected name.
Clearing the name reverts it to returning an empty string ("").

Steps to Reproduce:
Store a Spidertron inside a chest.
Use the Lua script to access the entity_label property of the Spidertron.
Observe the return values when the Spidertron has no name and when it is named.
Expected Behavior:

The entity_label should return:
An empty string ("") if the Spidertron is unnamed.
The name of the Spidertron as a string when it is named.

Actual Behavior:
Unnamed Spidertrons return an empty string, which is expected.
Named Spidertrons return nil instead of the assigned label, which is unexpected.

Additional Information:
Other properties, such as entity_color, seem to work as expected. This issue might be isolated to reading the entity_label. Writing to the entity_label was previously documented and fixed, but there seem to be no reports on reading behavior.

Re: Bug: Reading entity_label from Spidertron in Chest

Posted: Sat Sep 14, 2024 10:05 pm
by boskid
Thanks for the report. LuaItemStack::entity_label read is now fixed for 2.0.