lua-users home
lua-l archive

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


Yes, It works for me. Thanks.

2010/12/3 Benoit Germain <bgermain@ubisoft.fr>
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
> On Behalf Of Benoit Germain
> Sent: Thursday, December 02, 2010 5:17 PM
> To: Lua mailing list
> Subject: RE: 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?
>
> 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.

[BG] Looks like the code part is done. I luaL_loadstring what's given to me. It works as a regular function lane:


require "lanes"

local options = {globals = { b = 666 }}

local gen1 = lanes.gen("*", "dofile('fibonacci.lua')")
local gen2 = lanes.gen(options, "return b")

fibLane = gen1()
retLane = gen2()
fibLane:join()

print( retLane[1])

--->

fib(80)
... snip ...
fib(80) = 2.3416728348468e+016
2.3416728348468e+016
666
Killed 1 lane(s) at process end.


Would this do?