Add the ability to unset sprites on GUI elements

Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Add the ability to unset sprites on GUI elements

Post by Therenas »

Currently, you can set a sprite to a supported GUI element anytime you like, you don't have to set it when creating the element. You can't however unset it after it's been set. Setting it to nil gives an error and setting it to an empty string doesn't do anything. I'd like to be able to unset the sprite without recreating the whole element, preferably by setting it to nil, but whatever works.

User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Add the ability to unset sprites on GUI elements

Post by Therax »

As a note, writing nil to a sprite or sprite-button gives an error. Writing empty string to a sprite clears the element, but writing empty string to a sprite-button does nothing.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add the ability to unset sprites on GUI elements

Post by Therenas »

Therax wrote:
Tue Aug 13, 2019 5:53 pm
As a note, writing nil to a sprite or sprite-button gives an error. Writing empty string to a sprite clears the element, but writing empty string to a sprite-button does nothing.
Yes exactly. What's even worse is that when you set it to an empty string, the sprite will still be shown visually, but reading .sprite will return the empty string, which is obviously not the sprite that's displayed.

Post Reply

Return to “Implemented mod requests”