From: John L. <jla...@gm...> - 2006-05-14 03:05:11
|
On 5/13/06, Steve Kieu <ha...@ya...> wrote: > > thinking about using luasocket (kepler project) as well but their uses = of > > coroutine (copas) make me a bit uncomfortable :-). And me think wxLua > > Sorry never tried this either. > couroutine in lua IMHO is not really a replacement for thread. But I thin= k > using it in wxLua is convinient enough to overcome the limitation; as if = I > have a > lua_interp =3D new wxLuaState(NULL, wxID_ANY); > and whenever I do a > > int retval=3Dlua_interp->RunFile(lua_file); > > wxApp will spawn a new thread (?) to run the lua file and control return > immediately. If this is correct then I can spawn several lua_file in > OnInit() without blocking the GUI; and the lua_file might be for the serv= er > process, the GUI. > > Correct me if I am wrong please. The wxApp will not spawn a new thread. wxLua runs the lua code in the main thread since it may create GUI elements and therefore *has* to be in the main thread. However the wxWidgets sockets use events so that you can make them non blocking. In this way you can create as many wxLuaStates creating as many wxSockets as you like with each wxLuaState's lua program handling the wxSocketEvents appropriately. > > already provide wxLuaSocket why not using it (even it is not easy to no= t > > link with it anyway) > > I don't know know what you mean by this? > :-). If you enable wxLuaDebug then you need to enable wxLuaSocket and ha= ve > to link your application with it even not using it, that is what I mean. = But > I can build the library only without debug and socket and wxlua, which is > fine, just save about 400Kb of size though. Ok, yes this is probably not clear, I will try to write a little about it in the docs. But to be sure, wxLuaDebug is just some simple debugging code for wxLua and wxLuaSocket is socket code for wxLua to communicate with another wxLua program for debugging. To turn them off set in modules/wxbind/setup/wxluasetup.h #define wxLUA_USE_wxLuaDebugServer 0 otherwise the bindings will have the wxLuaDebugServer which the wxlua app uses to debug programs and therefore you have to link to the wxLuaSocket module. Regards, John Labenski |