lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Mar 21, 2010 at 8:44 PM, Pan Shi Zhu <pan.shizhu@gmail.com> wrote:
> On Sun, Mar 21, 2010 at 7:41 PM, Asko Kauppi <askok@dnainternet.net> wrote:
>>
>> I think it did not copy the environment, though that could actually be
>> implemented if needed.
>>
>> It would copy the function given as upvalue. It only stops when there's a
>> recursion (i.e. it cannot copy a function which has itself as upvalue,
>> though even this could possibly be implemented, if needed).
>>
>
> What I want is to serialize a function and transmit it in a network
> socket, then unserialize it in another process (the process runs on
> another computer).
>
> does lua lanes copied function support this?

Here's a Lua serialization library I wrote for an IRC bot. It can
serialize anything but unknown C functions, all userdata, and
coroutines. (It also uses the debug.upvalue & debug.upvaluejoin from
Lua 5.2 but this is backwards compatible.)

http://www.batbytes.com/serialize.lua


-- 
- Patrick Donnelly