Re: Saving a Lua table in C/C++?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Saving a Lua table in C/C++?
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: 2003年2月13日 22:07:52 +0100
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