Re: C Function with variable number of parameters
Jason McKesson <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
On 7/28/2010 5:04 AM, Nigel Atkinson wrote: > Hi Markus, > > I think perhaps the simplest way would be to register this particular > function using Lua functionality directly. You could still use > luabind::object::from_stack within the function. > > I.e. > > int dispatch( lua_State *L ); > > and > > http://www.lua.org/manual/5.1/manual.html#lua_register > > Nigel > > > On Tue, 2010-07-27 at 15:51 +0200, Markus Klotzbuecher wrote: >> Hi, >> >> I have a (dispatching) C function (not an ANSI C varargs) which >> depending on the first parameter requires a variable number of >> additional parameters. I currently solve this by registering functions >> with arity 0 to 4 taking luabind::objects. What I would like to do is >> register only one function with one arg which then can inspect the >> stack using lua_gettop and call luabind::object::from_stack to get the >> remaining arguments. What prevents this however, is luabind checking >> for the exact number of parameters and complaining "No matching >> overloads found". Does anybody know how to solve this? >> >> Thanks in advance! >> Markus >> >> ------------------------------------------------------------------------------ >> The Palm PDK Hot Apps Program offers developers who use the >> Plug-In Development Kit to bring their C/C++ apps to Palm for a share >> of $1 Million in cash or HP Products. Visit us here for more details: >> http://ad.doubleclick.net/clk;226879339;13503038;l? >> http://clk.atdmt.com/CRS/go/247765532/direct/01/ >> _______________________________________________ >> luabind-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/luabind-user > > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://ad.doubleclick.net/clk;226879339;13503038;l? > http://clk.atdmt.com/CRS/go/247765532/direct/01/ > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user > But if its not a Luabind function, then C++ exceptions can pass through it. ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm