lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>What I need to do is to be able to pass these popped lua values to a
>variadic C function.

>Note that I can't put the lua interface inside the variadic function
>directly as I'm using an API for which I only have the library,
>instead I have to create a C binding that turns around and calls the
>variadic function.

Most APIs in C have an alternate entry point for each variadic function
which accepts a pointer to a list of arguments instead of an argument
list. In fact, most variadic functions are just wrappers which call
these "worker" functions. For examples in the C standard library, see
the documentation for vsprintf and vscanf.

If the API with which you are working provides this option, it would be
a relatively simple task to bundle your Lua arguments into an array and
call the "v" flavor function.

Kurt Jung