[0.17.79][API] Error when setting LuaEntity.color to nil

This subforum contains all the issues which we already resolved.
robot256
Filter Inserter
Filter Inserter
Posts: 948
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[0.17.79][API] Error when setting LuaEntity.color to nil

Post by robot256 »

Actual behavior:
Reading LuaEntity.color with no custom color set returns nil.

Setting LuaEntity.color to nil will produces a "cannot index nil value" Lua error. This means that (a) mods apparently can't set entities back to the "default" color once it has been changed, and (b) every attempt to copy color from one entity to another must surrounded by a check to make sure the color value from the source entity is not nil.

Expected/desired behavior:
Reading LuaEntity.color with no custom color set returns nil.

Setting LuaEntity.color to nil should not produce an error, and should set the entity back to the "default" color. This would make the interface symmetric so that all values read from LuaEntity.color can also be assigned to LuaEntity.color.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14413
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.79][API] Error when setting LuaEntity.color to nil

Post by Rseding91 »

Thanks for the report. It's now fixed for the next version of 0.17.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”