lua-users home
lua-l archive

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


well, obviously it is not necessary to have that function as a member of the
object, but having it there prevents polluting the global namespace with a
function that is related to your userdata objects. Also that way, if your
metatable is protected, no one can remove the function from there, which is
not the case if it is globally registered. But this can be considered as a
drawback though :-)

-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]De la part de Jonas Meyer
Envoyé : jeudi 28 octobre 2004 17:58
À : Lua list
Objet : Re: defining swap


This worked just fine, and lets me swap the values.
I do have a meta table(luabind creates it), but i fail to understand
why it is needed here? Was it just for registering the function as a
memberish one( ":"-syntax )?