lua-users home
lua-l archive

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


It worked!

Thank you very much!

--- Groleo Marius <groleo@gmail.com> wrote:
> Hope this helps.
> Note that when you declare something like:
>  a =Account(100);
> a is already a pointer to the class Account.
> 
> I presume this is what you are looking for:
> If i'm wrong, please be more specific.
> 
> 
>  static int check( lua_State *L) {
>           Account* a =checkAccount( L, 1);
>           int amount =( int)luaL_checknumber( L,2 );
>           a->check( amount);
>           return 0; // supose Account::check doesent
> return any value
>      }
>      
> static Account* checkAccount( lua_State* L, int
> narg) {
>           luaL_checktype( L, narg, LUA_TUSERDATA);
>           void* ud =luaL_checkudata( L, narg,
> className);
>           if( ! ud)
>                luaL_typerror( L, narg, className);
>           return *( Wrapper**) ud;                
> // unbox pointer
>      }



	
	
		
Yahoo! Acesso Grátis - Internet rápida e grátis. 
Instale o discador agora! http://br.acesso.yahoo.com/