[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Couple of technical questions
- From: Benoit Germain <bgermain@...>
- Date: Tue, 18 Feb 2003 10:38:03 +0100
It is not a problem for me, end users will be told not to use "__" to prefix
their own variables. I have a hammer and baseball bat on my desk to enforce
this :-)
-----Message d'origine-----
De : Peter Hill [mailto:corwin@iinet.net.au]
Envoyé : mardi 18 février 2003 10:37
À : Multiple recipients of list
Objet : Re: Couple of technical questions
Peter Hill:
> (2) Why do metamethods have a double underscore prefix? That seems to
imply
> that the metatable will be filled with other, otherwise conflicting,
> entries.
Benoit Germain:
> a metatable can be filled with whatever you want. I am currently using
this
> feature to implement a scheme similar to the proxy mechanism: a full
> userdata comes with a metatable that contains __index and __nexindex
> functions that get and set fields in the metatable itself (in addition to
> fetching predefined members as well). That way, the full userdata can be
> used as any regular table.
Wouldn't it be better to use a separate table as the proxy? That way it
could store any values (even "__blah" ones) without unexpected consequences.
*cheers*
Peter Hill.
Ki: Contractors... high-paid leeches stealing our work.
Fooker: If you think of them as disposable employees, you'll feel much
better...