I'm looking at the widget handler and trying to figure out how it works so that I can implement something similar in other projects
As I understand it so far widget loading goes along the following lines, please correct em if Im wrong or miss out a vital step
A new table is created that holds the widget, it's filled in with some functions that act as default callbacks, and a reference to the widget handler is inserted
This widget is then set in it's own environment using setfenv, and then the widget file loaded into a variable is then passed to pcall, filling in Widget with all the methods and variables, as well as executing any lines of code.
The widget table is then added to the main list and sorted into the right order.
Is that correct? Am I missing any important steps? Is there a better ideal way that we don't use because we already have this setup? I assume the gadget handler works the same way?
Widget Handler Implementation
Moderator: Moderators
Re: Widget Handler Implementation
don't try to learn from the current widgetHandler, it's very very bad code.
First the way widgets are managed is very inefficient, and then the way callins are handled is very very very inefficient. It needs a totally new implementation, trepan already did parts of such a recode for bzFlag, but I didn't checked it yet.
First the way widgets are managed is very inefficient, and then the way callins are handled is very very very inefficient. It needs a totally new implementation, trepan already did parts of such a recode for bzFlag, but I didn't checked it yet.
Re: Widget Handler Implementation
hmmm so what exactly would you suggest?