[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Using lua_pushlightuserdata to bind classes
- From: Jose Marin <jose_marin2@...>
- Date: Mon, 7 May 2007 09:14:19 -0700 (PDT)
Hi.
Is there any tutorial/sample on how to use light userdata to bind C++ classes to Lua?
I used the sample on http://lua-users.org/wiki/UserDataWithPointerExample as a base to learn how to bind using lua_newuserdata, but I would like to use lua_pushlightuserdata to do this.
I've tried to change the sample code
Image *pi = (Image *)lua_newuserdata(L, sizeof(Image));
*pi = im;
to this
Image *pi = new Image;
lua_pushlightuserdata(L, pi);
but it doesn't work.
Jose
__________________________________________________
Fale com seus amigos de graça com o novo Yahoo! Messenger
http://br.messenger.yahoo.com/