How can I install Window types in lua ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I install Window types in lua ?

鸡肋
Question 1 :

I installed a class member function like below :

member function :
        HWND CRenderManager::GetSafeWnd()
{
DCHECK(::IsWindow(m_hWnd));
return m_hWnd;
}

install to lua :
       void CRenderManager::InstallToLua( lua_State* luaState )
{
DCHECK(luaState);
using namespace luabind;
module(luaState, "ui")
[
class_<CRenderManager>("RenderManager")
.def("GetSafeWnd", &CRenderManager::GetSafeWnd)
];
}

Now, I use the member function in lua :
 function SysButton:OnClose(object)
local render = object:GetRenderManager() -- Get RenderManager installed
render:GetSafeWnd() -- Here is the problem ?
end

When the code step out the member function, it throw an exception like this :
[c]-1(method GetSafeWnd) std::runtime_error: 'Trying to use unregistered class'

Is it because the HWND type should be installed to lua ?  I look up MSDN :
typedef HANDLE HWND;
typedef PVOID HANDLE;
typedef void *PVOID;
How can I install Windows types (HWND, HANDLE...) to Lua ?
Question 2 :
How can I register Windows API (PostMessage、SendMessage、Point) to lua ? 











------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

Re: How can I install Window types in lua ?

Teto
"Trying to use unregistered class' means the class you are registering
either takes an unregistered parameter or returns one which you need
to register.
Windows mainly use void* you need to cast. I am not sure how luabind
reacts to that. You could try to cast explicitly functions on
registration.

2012/3/31 鸡肋 <[hidden email]>:

> Question 1 :
>
> I installed a class member function like below :
>
> member function :
>         HWND CRenderManager::GetSafeWnd()
> {
> DCHECK(::IsWindow(m_hWnd));
> return m_hWnd;
> }
>
> install to lua :
>        void CRenderManager::InstallToLua( lua_State* luaState )
> {
> DCHECK(luaState);
> using namespace luabind;
> module(luaState, "ui")
> [
> class_<CRenderManager>("RenderManager")
> .def("GetSafeWnd", &CRenderManager::GetSafeWnd)
> ];
> }
>
> Now, I use the member function in lua :
>  function SysButton:OnClose(object)
> local render = object:GetRenderManager() -- Get RenderManager installed
> render:GetSafeWnd() -- Here is the problem ?
> end
>
> When the code step out the member function, it throw an exception like this
> :
> [c]-1(method GetSafeWnd) std::runtime_error: 'Trying to use unregistered
> class'
>
> Is it because the HWND type should be installed to lua ?  I look up MSDN :
>
> typedef HANDLE HWND;
>
> typedef PVOID HANDLE;
>
> typedef void *PVOID;
>
> How can I install Windows types (HWND, HANDLE...) to Lua ?
>
> Question 2 :
>
> How can I register Windows API (PostMessage、SendMessage、Point) to lua ?
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> luabind-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user