lua-users home
lua-l archive

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


Hi,
First, let me say that I like Lua a lot, and hope to extend it by 
combining with other nice pieces of open software out there.  I toyed 
with 3.2 a while back and compared it against Pike, for the purposes 
I had in mind (a GUI, multi-threading for network/WEB programming, 
printing).  I prefer Lua's well structured and documented interface 
to the C/C++ world.  However, Pike has built-in multi-threading.

Currently I'm experimenting with 4.0 alpha.  Trying to determine if I 
can implement a coarse form of multi-threading.  The model I have in 
mind is to start every new thread with a new Lua state - in essence, 
an interpreter per thread.  I also like to interface C/C++ libraries 
to Lua.  I have not gotten very far when I realize that I really need 
Lua to pass me its state when it calls my C functions, otherwise I'd 
have to maintain that state independently, which is cumbersome at 
best.  Instead, if the prototype for lua_CFunction is changed from:
typedef void (*lua_CFunction) (void)
to :
typedef void (*lua_CFunction) (lua_State*)
,
then it makes my job a lot easier.  Since Lua knows its state at the 
time of calling a lua_CFunction, I expect this modification to be 
quite easily implemented for 4.0.

One other potential big problem with the interpreter/thread model is 
code bloat, when several threads are started that run the same Lua 
code.  I don't know if it is possible for multiple Lua interpreters 
to share Lua byte code, and still run in different threads.

Any comments ?

Regards.