lua-users home
lua-l archive

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


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/