Re: default argument support

Ryan Pavlik <[email protected]> Fri, 14 Oct 2011 15:43:13 -0500
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CABMFTE9U71vC6q5iEP1Thn5i1B=cXQFxfACbtCOovRG1HHqwVA@mail.gmail.com>
On Fri, Oct 14, 2011 at 3:00 PM, Jeremy Sandell <[email protected]> wrote:

> Hello,
>
>     Does anyone know if there's any plan to support C++ functions that use
> default arguments in LuaBind? Boost.Python has this, though from what I
> understand it saves the name of the argument as well as the value, which I
> don't imagine Lua would need.
>
> Thanks!
> Jeremy Sandell
>

So default arguments for functions in C++ are strictly a compile-time
phenomenon - this is the appropriate section of the boost python docs:
http://www.boost.org/doc/libs/1_47_0/libs/python/doc/tutorial/doc/html/python/functions.html#python.default_arguments

You can do the manual wrapping thing - that's what I've been doing. However,
that macro and "def" overload looks handy and probably the only way to do
this simply, so that might be something worth porting to luabind.

Here's what I've done in some cases to make the manual wrapping easier:
https://github.com/vance-group/lua-hapi/blob/master/src/ForwardingMacros.h
https://github.com/vance-group/lua-hapi/blob/master/src/ForwardingMacrosUndef.h

example of use:
https://github.com/vance-group/lua-hapi/blob/master/src/HAPIHapticsDevice.cpp

Ryan


>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
>


-- 
Ryan Pavlik
HCI Graduate Student
Virtual Reality Applications Center
Iowa State University

[email protected]
http://academic.cleardefinition.com

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user