lua-users home
lua-l archive

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


On Fri, Aug 7, 2015 at 6:38 PM, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Rena once stated:
>>
>> The thread libraries I've used run a separate Lua state in each thread and
>> provide some type of communication channel between them. This is a nice
>> simple model, but maybe not the most efficient. In particular, while it's
>> usually possible to pass most types of Lua objects between threads, tables
>> can only be recursively copied, functions have to be dumped and recompiled
>> (and can't have upvalues), and userdata can't safely be passed around
>> unless it's designed to be referenced by multiple Lua states.
>
>   Actually, you can serialize Lua functions with upvalues.  I've done it
> (just not shown the code).  In fact, I was able to serialize quite a bit,
> including tables with circular references.  The only things I couldn't
> handle were coroutines, user data and Lua functions written in C [1].

I figure I'll plug my serialization code again [1] in case someone
wants an example of this.

[1] https://github.com/batrick/lua-serialize

-- 
Patrick Donnelly