|
I'm sorry if there is already a project thats doing this, but I could not get to luaforge to see. I am trying to write a very simple ipc/mp module for LUA, and I have run into a snag. I am hoping someone on the list with a greater knowledge of the internals of LUA might be able to help. The basic idea of the module is that it be very simple, and flexible so my first pass took the nieve approach of just using lua_dump and lua_load to martial a function across the ipc mechanism (I am using posix message queues, but there is no reason it couldn't be anything else.). The idea was to be able to get a value from one process to another by doing something like: function genmartial(value) return function() return value end end foo = { 'a' = "a string", 'b' = 3.1415 } ipc:send(genmartial(foo)) But this does not work, because when lua_dump creates the chunk, the upvalue gets lost. Does anyone know of a way to do something almost as simple (I would like to make it so that all the marshalling is done in lua, not C) to get the data through? In order for this to work would I have to martial and send a lua_State *? If so, what parts would I have to send? I would prefer not to send one at all, as it requires the library (and I) know more about the internals of LUA. I want to avoid modifying LUA itself completly, as this defeats the purpose of a flexible (read most of the work is done in LUA for flexibility) module for message passing. Oh all of this would be for LUA 5.1+. And if anyone is interested I will be releasing my code under the LUA license when its useable (not necessaily bug free tho! ;) Thanks, Mike Panetta |