Bug: Reading entity_label from Spidertron in Chest

This subforum contains all the issues which we already resolved.
cal12345
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Sep 02, 2024 4:39 pm
Contact:

Bug: Reading entity_label from Spidertron in Chest

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3078
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Bug: Reading entity_label from Spidertron in Chest

Post by boskid »

Thanks for the report. LuaItemStack::entity_label read is now fixed for 2.0.
Post Reply

Return to “Resolved Problems and Bugs”