lua-users home
lua-l archive

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


Michael Panetta wrote:
[...]
> But this does not work, because when lua_dump creates the chunk, the
> upvalue gets lost.

Yeah, you can't dump functions with upvalues.

If I understand you correctly, you want to send a data structure from
one Lua universe to another Lua universe that may be in a different
address space, right? There are lots of ways of doing this depending on
your exact data structure, but the simplest is probably to serialise the
data structure into a string and send that. (Simple, but not
particularly efficient.)

The code for this is pretty trivial; I don't have the 5.1 PiL, but the
5.0 PiL has a discussion of it here:

http://www.lua.org/pil/12.1.2.html

This version produces Lua code, so the unserialisation procedure
involves simply executing the string.

-- 
+- David Given --McQ-+ "You cannot truly appreciate _Atlas Shrugged_
|  dg@cowlark.com    | until you have read it in the original Klingon."
| (dg@tao-group.com) | --- Sea Wasp on r.a.sf.w
+- www.cowlark.com --+

Attachment: signature.asc
Description: OpenPGP digital signature