[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Faster checking of userdata
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 27 Aug 2004 09:34:20 -0300
> if( !lua_getmetatable( L, index ) )
> return NULL;
> lua_pushlightuserdata( L, udkey ); /* ( ... mt udkey )
> lua_rawget( L, -2 ); /* ( ... mt mt[ udkey ] )
This technique is not safe. A Lua program may get udkey (traversing the
metatable of a userdata) and then add it as a key in the metatable of a
userdata from a different kind, fooling checkudata.
-- Roberto