Page 1 of 1

[1.1.25] Cannot write "nil" to LuaEntity::entity_label

Posted: Mon Mar 01, 2021 8:19 pm
by robot256
What happens:
LuaEntity::entity_label returns nil for entities without a label and spidertrons with no label set. (makes sense)
Writing an empty string "" clears the label, which is read back as nil. (makes sense)
Writing any string to an entity that does not support entity_label has no effect or error message. (makes sense)
Writing nil to LuaEntity::entity_label returns the error "Error: "label": string expected, got nil". (unexpected, because I read nil from it moments ago)

What I expect to happen:
Writing nil will clear the label, so that it is safe to write LuaEntity::entity_label with any result we can read from it.

Re: [1.1.25] Cannot write "nil" to LuaEntity::entity_label

Posted: Mon Mar 01, 2021 8:43 pm
by Rseding91
Thanks for the report however that's not a bug; that's a modding interface request. It's a fine request but it doesn't go in bug reports.

Re: [1.1.25] Cannot write "nil" to LuaEntity::entity_label

Posted: Mon Mar 01, 2021 9:00 pm
by robot256
Thanks and Sorry! I keep getting them mixed up.