Page 1 of 1

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

Posted: Sat Jan 18, 2020 7:35 pm
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.

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

Posted: Sat Jan 18, 2020 10:47 pm
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.17.