No other responses, so I'll try. I looked at the post for twenty minutes, again 
later that day, and breifly the next morning, hoping to learn from it if I 
couldn't help, and I'm stumped. :) I can't fully understand the question. Any 
way to reduce it to a simple form? (not dependent on the context of wxArt2D 
which I found baffling..)

I looked at the PIL example which I understood, but I'm not sure how it relates 
fully. I have read that Lua's tables will apply well to hash tables as well as 
arrays, so it oughyt to work. 'Hash table' is a term I never used so I'm still 
not sure of it but if it means key/value pair lookups, then it's good, Lua does 
those well. Also string handling. So part of what you asked suggests an 
organisational method, so using key name aliases in short forms with a letter 
in place X or a digit in place Y for easy parsing might allow a way to select 
arbitrary groups of related commands easily and fast. where the value paired 
with the alias key is the actual function you want.

As far as I can tell, that's not all you asked for, I guess if it was it would 
be easy, but you need to pass these functions arbitrary arguments also? That's 
where my grasp lets go because I don't know if you need some general store of 
such arguments to check with, or just write the functions so each knows what to 
do with what is passed to it.

Regarding interfacing to C++ or wxWidgets, my instinct would be to aim to do it 
in pure Lua to sidestep that problem.


"klaas.holwerda" <n...@klaasholwerda.nl> wrote:
(11/05/2009 20:59)


>
>Hi,
>
>I want to wrap tuples like in python, but in lua its a table initialized 
>for a function with{}.
>This makes it possible to mention only the parameters the user wants to 
>specify, and not a whole range, which is hard to remember in position etc.
>But in my case certain groups of arguments are related, while others are 
>for other task done with the same command. So  it would be very hard to 
>use from Lua, or even C++, doing it the standard way with simple 
>arguments to a function.
>
>It is explained here, how its done in lua:
>
>http://www.lua.org/pil/5.3.html
>
>In wxLua i like to use:
>
>wx.a2dCommand_GroupAB{ what = a2dCommand_GroupAB:BoolOperation_GroupAB, 
>operation = BOOL_A_SUB_B, selectedA = true, selectedB = true }
>AddCommandToMenu( booleanObjects, _("Boolean A-B"), _("Boolean 
>Subtract"), command );
>
>I have many of those type of commands, so i would like to generate a 
>binding in an elegant way for all of them.
>The question is how can one interface such thing to C++/wxWidgets. The 
>thing is  that  the arguments  in general are all of different types.
>I think that almost results in a hash, with pointers to member 
>functions?? Or maybe wxVariants??
>I believe what i am looking for is some standard hash like structure in 
>which the wrapper stores the arguments.
>Next my commands have a member function/constructor, with one argument 
>being that hash. That member function checks  what is  in the hash,  and 
>do the right thing.
>
>BUT maybe it could wrap directly in to what is show down here, and that 
>would be save and compiler checked.
>Like a special keyword in the *.i file, that has a function definition, 
>with all possible arguments/tuples,  and  wraps them in a special way to 
>C++.
>Like iterating over the table, and for each key in there, call a 
>specific Args::argumentX() function.
>After the iteration the Args object containing all arguments found is 
>complete, and the constructor is called with that Args objects as parameter.
>
>Ideas very welcome!
>
>Klaas
>
>Currently inside C++ i do something like the above, but used from within 
>C++ itself.
>That is based on the Args object, its members functions returning a 
>reference to itself:
>
>a2dCommand_GroupAB* command = new a2dCommand_GroupAB( 
>a2dCommand_GroupAB::Args().
>                what( a2dCommand_GroupAB::BoolOperation_GroupAB ).
>                operation( BOOL_A_SUB_B ).
>                selectedA( true ).
>                selectedB( true ) );
>AddCommandToMenu( booleanObjects, _("Boolean A-B"), _("Boolean 
>Subtract"), command );
>
>Here it is in Doxygen /and code, maybe it helps.
>
>http://www.wxart2d.org/wxart2dDoxygen/html/classa2dCommand__GroupAB.html
>http://www.wxart2d.org/wxart2dDoxygen/html/classa2dCommand.html
>
>
>------------------------------------------------------------------------------
>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


------------------------------------------------------------------------------
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

Reply via email to