Add the ability to unset sprites on GUI elements

Post Reply
Therenas
Fast Inserter
Fast Inserter
Posts: 108
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Add the ability to unset sprites on GUI elements

Post by Therenas » Tue Aug 13, 2019 1:28 pm

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: 416
Joined: Sun May 21, 2017 6:28 pm
Contact:

Re: Add the ability to unset sprites on GUI elements

Post by Therax » 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.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

Therenas
Fast Inserter
Fast Inserter
Posts: 108
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Add the ability to unset sprites on GUI elements

Post by Therenas » Tue Aug 13, 2019 7:12 pm

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”

Who is online

Users browsing this forum: No registered users