lua-users home
lua-l archive

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


> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of zhiguo zhao
> Sent: Thursday, December 02, 2010 3:40 PM
> To: Lua mailing list
> Subject: request feature of luajit2 or lanes

>   To solve my problem, luajit2 need to support lua_dump or lanes support lanes.gen with lua filenames(without use lua_dump to get entrypoint function).

>   Who can do me a favor,Mike or benoit?

lua_dump is used by lanes to copy the function from one Lua VM to another independent VM. The function in the source Lua VM is dumped, then the generated buffer is loaded in the target Lua VM to create a function, and upvalues are copied too. I'm pretty sure this can't be done differently using the public API.

If the provided "function" is in fact a string, Lanes could probably either "luaL_loadfile" or "luaL_loadstring" it directly in the target Lua VM. This has the advantage that there are no upvalues to be taken care of. I'll have a look at it, just in case it is easy to do.

But this doesn't solve the fact that Lanes won't work with regular functions if the VM's implementation doesn't support lua_dump.