John Labenski wrote: > wxLua does not save the string name of function parameters so they > can't be looked up later. I do use this facility in Python and like > it, but I think it might bloat the wxLua bindings even more. I did realize this one is not so easy. Is it a wxLua specific thing, or lua? Still it makes so much sense to have in certain cases, even in wxWidgets itself, where parameter lists are long sometimes. Of course the most can be default, but if the last one needs to be set, you still need to add all others. Still doable, but for my commands it would be really the ideal way.
> > Currently, each binding function is crafted to get and check the input > parameter type with the minimum of code. Allowing a table like this > means that we'd have to look through it and assign the variables as > they come, keep track of them all to give messages about missing > required parameters, while still allowing for positional arguments. It > might also be a lot slower since you have create the wxVariant, fill > it, then read it out as opposed to simply creating the correct > variable type, filling it, and using it as is. I was more thinking not to have a general mechanism, that can be used always, but more how to wrap to a C++ member taking one argument being the wxVariant hash, or the function hash. So parameter checking is all up to the C++ member receiving that hash. The hash is build from the lua parameter list when using the special syntax, giving a table as input. It would be a specific kind of wrap, for only that member, and for other normal wrapped functions it would not work. Maybe this would make it simpler?? Or maybe i don't understand it all completely :-) > > I have thought briefly about using a wxVariant type holder for each > parameter, but I can imagine that there might be some trouble leading > to a lot of hand crafted bindings. It's a *big* change for wxLua > that's built into the Python interpereter. On the other hand, the > error messages could be quite a bit more informative and this would > allow for better interactive help like Python. Right, if it would be a general mechanism, it would be much more complicated. So therefore, just for certain situations doing this kind of wrap. > > wxLua does already save the variable types in an array. See > http://wxlua.cvs.sourceforge.net/viewvc/wxlua/wxLua/modules/wxbind/src/wxcore_bind.cpp?revision=1.21&view=markup > > <http://wxlua.cvs.sourceforge.net/viewvc/wxlua/wxLua/modules/wxbind/src/wxcore_bind.cpp?revision=1.21&view=markup> > Search for : s_wxluatypeArray_wxLua_function_wxDirSelector Yep, i understood that you already preserve the types mentioned in the *.i files, and test for it. In the next array there should be something of all possible named arguments/tuples, so the *.i files should contain something that mentions them all. Then it can be used to test the table it contents. That is what i meant with the special keyword for defining a function accepting named arguments. e.g. something like this: %tableargs bool memberFunctionName( double a = 1.0, wxString b = "abc", int c = 1 ) > > We could simply add another const char** array of the string names for > each variable to go with the types and yes we could then create an > array of wxVariants (or more likely our own variant class based on the > wxluatype_XXX integers for types). Yes, i think that would be enough. > That is... different. I'm not sure it seems natural to me, but it is a > little more verbose. It did come up on the wxDev mailing list a few times for using it in C++, and i started using it. > > I am currently working on adding the ability to have multiple base > classes. It's not too hard, but I have to ensure that I change all the > code that expects a single base class to not recurse into the list of > base classes. I hope this is not related to the above?? Not sure what this solves/means, multiple inheritance? Currently i am adding extra events to wxArt2D, instead of virtual functions, since i finally realized that, connecting function to events in wxLua is easy. But overriding virtual functions would need class defenition in wxLua, which are not there :-) So i like to fill up menu's in a drawing window, using a Theming event, which connect to/calls a lua function to fill the menu's. And such i struggle on :-) Once again thanks for wxLua, it works just very nice! Maybe i manage to make a wxart2d module one day. Using wxLua inside, and at the same time making it a module confuses my mind :-) Klaas ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users