lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Rici Lake
> Sent: Thursday, October 14, 2004 2:53 PM
> To: Lua list
> Subject: Re: Userdata with methods *and* table access.

> You can count on the char pointer to be the same provided the 
> string never gets garbage collected. (i.e., if you keep a 
> reference to the string somewhere.)
> 
> In that case, though, you might as well use the Lua string 
> itself as a key into a table whose values are, for example, a 
> structure of getter and setter functions for that key.

 Interesting idea.  I'll check it out and see if this beats the string
compares with inlined setters and getters.

 I've also figured I can use lua_topointer() directly on the metatable to
check my userdata type instead of a registry lookup and a string compare
like luaL_checkudata() does.  This should be a big win for all my exported
functions.

  Tom