Re: C Function with variable number of parameters

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1280318694.2045.24.camel@ankh>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.