[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: passing tables to registered functions
- From: Benoit Germain <bgermain@...>
- Date: Fri, 22 Nov 2002 10:00:46 +0100
oops, you must read
while ( n != lua_gettop ( l ) ) ;
> -----Original Message-----
> From: Benoit Germain [mailto:bgermain@ubisoft.fr]
> Sent: vendredi 22 novembre 2002 09:57
> To: Multiple recipients of list
> Subject: RE: passing tables to registered functions
>
>
> something like that (untested) ?
>
> int my_c_function(lua_State *l)
> {
> int i = 1 ;
> int n = lua_gettop ( l ) ;
> do
> {
> lua_rawgeti ( l , 3 , i ) ;
> ...
> } while ( n == lua_gettop ( l ) ) ;
> }
>
>
> > -----Original Message-----
> > From: xenarcher [mailto:nickl@volition-inc.com]
> > Sent: jeudi 21 novembre 2002 22:20
> > To: Multiple recipients of list
> > Subject: passing tables to registered functions
> >
> >
> > Say I've got the following C function:
> >
> > int my_c_function(lua_State *l)
> > {
> > ...
> > }
> >
> > And later on in the code, I register my_c_function():
> >
> > lua_register(L, "my_lua_function", my_c_function);
> >
> > Now, say I have the following Lua code:
> >
> > function foo(a, b, ...)
> > my_c_function(a, b, arg)
> > end
> >
> > In my_c_function(), how do I dereference the values
> contained in the
> > arg table passed to it?
> >
>