[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Saving a Lua table in C/C++?
- From: pixellent@...
- Date: Thu, 13 Feb 2003 18:06:11 -0500
Thanks Wim.
I'm not exporting a C function; I'm using tolua to wrap the Schedule function in
my TimerManager class. I guess that means I can't use lua_ref() to pop from the
stack. Does this mean there's no specific type that can be used to tell tolua to
pass a table as a parameter?
Thanks again
Mike
Quoting Wim Couwenberg <w.couwenberg@chello.nl>:
> Hi,
>
> > I'm a little confused as to how I
> > could save the table as there doesn't seem to be a specific "table type".
> Any
> > help is greatly appreciate.
>
> This can be done using so-called references. Have a look at section 5.14
> "references to Lua objects" in the Lua 4 documentation. Basically you do a
> lua_ref(state, 1) call to pop the top-of-stack and obtain a reference to it
> (make sure your table is at tos.) A call to lua_getref(state, ref) will
> push the table back on to the stack. Use lua_unref to drop the reference if
> you no longer need it.
>
> Bye,
> Wim
>
>
>