Currently, you can only read a LuaGuiElement's name. I would love to be able to modify the name as well.
The reason is that while I don't use names to match against to fire specific GUI handlers, I do use them to encode information about which button was clicked for generic handlers. For example, I could have nine similar buttons that are all displaying different LTN depots, and I want to know which one was clicked.
Storing that information in the name is a lot easier than making a thing to store it in `global` and managing it myself. But, unless I destroy and re-create the element, there's no way for me to update which depot the button is referencing, leaving storing it in global as the only option.
Thanks!
Make LuaGuiElement::name writable
Make LuaGuiElement::name writable
Don't forget, you're here forever.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Make LuaGuiElement::name writable
-1/+2
+2 I would also like a way to store extra data in LuaGuiElements that doesn't somehow influence how the element itself looks. Something like LuaEntity.tags. (My personal hack is to store data in invisible childrens labels.)
-1 Because you say yourself that you don't actually care about element names. You just want a more powerful hack to solve the actual problem - but you request a hack.
+2 I would also like a way to store extra data in LuaGuiElements that doesn't somehow influence how the element itself looks. Something like LuaEntity.tags. (My personal hack is to store data in invisible childrens labels.)
-1 Because you say yourself that you don't actually care about element names. You just want a more powerful hack to solve the actual problem - but you request a hack.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Make LuaGuiElement::name writable
I would be ecstatic if we could store "tags" on a GUI element. That would solve all sorts of problems that I've been using the name for.
Don't forget, you're here forever.