[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Not able to copy Lua closures between states
- From: "Patrick Donnelly" <batrick.donnelly@...>
- Date: Thu, 3 Jul 2008 03:14:46 -0600
Hi Asko,
On Thu, Jul 3, 2008 at 2:04 AM, Asko Kauppi <askok@dnainternet.net> wrote:
> Could future Lua have a mechanism similar to 'lua_pushcclosure' for Lua
> functions? Is there some reason why this cannot (ever) be done?
I ran into this problem when memoizing a state. When you load the
binary string in Lua, the upvalues are set to nil. You can change them
manually using the debug library.
Also, I believe you may be looking for a way to share upvalues (that
is, two Lua functions may use the same upvalue)? I made a patch
recently that allows you to do this
(http://lua-users.org/lists/lua-l/2008-02/msg01173.html). If you
intend to use it, please use this updated patch:
http://www.unm.edu/~batrick/lua/upvalue.patch
Cheers,
--
-Patrick Donnelly
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."
-Will Durant