[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Not able to copy Lua closures between states
- From: "Patrick Donnelly" <batrick.donnelly@...>
- Date: Thu, 3 Jul 2008 03:14:46 -0600
On Thu, Jul 3, 2008 at 2:04 AM, Asko Kauppi <email@example.com> 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:
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."