lua-users home
lua-l archive

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


Hi!

2010/10/7 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> int foo_setA( lua_State *L ) {
>>     Foo **d = (Foo**) luaL_checkudata( L, 1, "Foo" );
>>     (*f)->setA( luaL_checkint( L, 2 ) );
>>     lua_pushvalue( L, 1 ); // lua_pushuserdata missing?
>>     return 1;
>> }
>>
>> Is this usage save?
>
> It's completely safe. If you are in doubt, use
>        lua_settop(L,1);
> instead of lua_pushvalue.

Even better -- this makes it clear what is going on. I switched to
this alternative.

Thanks,
Matthias