Follow-up Comment #1, bug #25337 (project wesnoth):
I too prefer the second method, but rather than an unregister function, I
think it would make more sense to automatically unregister any custom
definitions when the Lua kernel is destroyed. (Which means that any
definitions registered in the Application Lua Kernel are available everywhere,
but that shouldn't be a huge issue since no-one uses the Application Lua
Kernel, plus it's not really meant to be used for GUI stuff.)
Basically, the register_widget_definition would do two things: 1) Register the
definition in the GUI settings, and 2) Add the definition to a list of ones to
unregister, stored in the Lua kernel class (probably lua_kernel_base). Then
the class's destructor would call an appropriate function to remove the
definitions from the GUI settings.
Naturally, this approach would mean you do not want to allow existing
definitions to be overridden, so register_widget_definition would need to
check that the definition doesn't exist before doing anything.
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?25337>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs