From: Steve K. <ha...@ya...> - 2006-08-03 23:55:40
|
Hi everyone, I am thinking a solution but not yet implemented to test it. I use wxApp to hold the data. So in MyApp class I add two methods: void SetGlobalObj(wxLuaState* ); void GetGlobalObj(wxLuaState* ); In SetGlobal I will get the lua table or light user data (it could be a table / or lightuserdata from a lua state.) Then set a member of MyAPP (which could be an r array or pointer) to hold the references. In GetGlobalObj I will push these pointer into a global lua table so in lua code (another lua state) I will get the references. After that I will dynamiccast to the wx class type and use it. So in second lua state call wxGetApp() and cast it to MyApp() then call GetGlobalObj(**) The purpose for now in my app is to use an already contructed wxSocket and pass it to the new thread that use different lua state. But if the above is correct then I can see some other usage as well. Any comment on it or I am just crazy :-) Cheers, S.KIEU Send instant messages to your online friends http://au.messenger.yahoo.com |