lua-users home
lua-l archive

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


> 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.

> I  hope it is still the same userdata object from the Lua perspective.

It is.