lua-users home
lua-l archive

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


Well, I figured out a way to do it.  Combining the 'serialize' function in the pil, with some crazy LUA tricks I came up with this genmarshal function that does what I want when I pass it through my IPC mechanism:

function genmarshal(data)
        local marshalfunc = loadstring([[
               function unmarshal()
                      ]] .. savetostring("data", data) .. [[
                      return data
               end]])
        return marshalfunc
end

Yes, its completely crazy, but it works, and for my application speed is not of the essence so it should be ok.  That, and I am sure I will figure out something more advanced when I get to see how Pluto works.

Mike

Lua list <lua@bazar2.conectiva.com.br> on Friday, September 15, 2006 at 11:44 AM +0000 wrote:
Michael Panetta wrote:


In that case, either write your functions so they don't have
upvalues, or initialize the upvalues within the functions.
If you want to do the former but still get upvalue-like
behavior, check out setfenv.

> And of course to send LUA data itself (tables, numbers,
> strings, whatever, it should not matter the type, with the
> exception of userdata, and probably threads of course).

As David Given pointed out, PiL shows how to do this.

--
Aaron