[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lua_ref's... how to?
- From: Ando Sonenblick <ando@...>
- Date: Wed, 15 Oct 2003 13:14:20 -0700
Gang,
Can someone give me a quick overview (or direct me to a page) that
describes what lua_refs can do? I've been looking for details on them,
but most web pages mention them without giving a "here's what and how"
about them...
They're also not in the 5.0 manual (that I was able to find).
FYI, what I'm hoping they'll be useful for is something like this: I'd
like to store an arbitrary lua type (be it a variable, a table, a
function, etc) in my C code for later use.
So Ideally, I could
myCPPObject->luaRef = lua_ref(L, true) -- take whats on the top
of the stack and make a ref
then, later in my C code, I can then use that:
lua_getref(myCPPObject->luaRef); -- push the contents of
the ref
<call a lua routine>
and then when done, no longer reference it:
lua_unref(myCPPObject->luaRef)
Is this how lua ref's work?
thx,
ando
-----------------------
Ando Sonenblick
SpriTec Software
www.spritec.com