lua-users home
lua-l archive

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


Hello ,

      When I wrote a windows application embedding lua, I want to call
      some lua code in WinProc . Like this :

-------------------------------
static LRESULT CALLBACK
WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) 
{
        switch (iMessage) {
        case WM_MOUSEMOVE:
             /* call some lua function */
             ...
---------------------------------

      But in WndProc , I can't get the running thread in lua .
      I can store the main lua state in a global variable, but the
      main lua state may not be the running thread. And I have no way
      to pass the L into the WndProc .

      How to get the current thread from the main lua state in C ?

-- 
Best regards,
 Cloud                          mailto:cloudwu@163.com
            http://blog.codingnow.com

[失去, 总令人舍不得, 但痛苦并不来自于失去, 而是来自于我们不肯放手]