[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Digest, Vol 30, Issue 4
- From: "mark gossage " <mark@...>
- Date: Thu, 21 Dec 2006 18:40:07 -0700
Eeeee, thats messy!
You didn't mention co-routines in your first mail.
I am not a co-routine guy, still think like a C++ programmer, not a lua programmer.
Well the concepts still stand: globals, or a window attribute.
The question is more: how are you going to manage the lua-states yourself?
If you have several states, then you have to know which one is for which. If you have a state whose task it is do the updating, you have to know which one to call. If you have another state which manages the keypresses or mouse clicks, you need to deal with that.
I cannot give any good advice on this. I suggest either a set of globals (for each routine), or a function to manage all of the states/corouties, which can provide the one you need.
If you can explain in a bit more detail, it might shed some light on the matter.
Hope this helps,
> Hello mark,
> Thursday, December 21, 2006, 9:06:20 AM, you wrote:
> mg> Option 2 is for when you need one lua_State per window.
> mg> You can read MSDN on GetWindowLong/SetWindowLong (I won't explain
> mg> But the following code will give you an idea:
> But message process and create window may not in the same coroutine.
> For example, if you are calling UpdateWindow in a lua coroutine.
> UpdateWindow will call SendMessage(hWnd,WM_PAINT) , and this will call
> my WinProc . At this time, it needs coroutine's lua_State *L , not the
> lua_State at the time window created .
> Best regards,
> Cloud mailto:firstname.lastname@example.org