[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Doc Issue -- was -- Naming userdata objects
- From: virgil@... (Virgil Smith)
- Date: Wed, 19 Nov 2003 12:11:07 -0600
As a side note it would be nice if a listing of all of the "special
modifiers" was made and added to the manual (perhaps as a side note in the
metatable section). The listing could just refer to the relevant section.
The reason for the suggestion is because it would make it easier to find
these options when thinking along the lines of "what can I do with object X"
as opposed to "what can function/system Y do with objects it receives".
If nothing else these items could at least be added to the glossary.
Below are some of the ones that a search of the manual for "__" turned up.
__pow -- global
__gc
__mode
__fenv
__metatable
__tostring
As a side note, now that I am thinking about this again it would be
interesting to see a compilation of common extensions / best practices for
libraries etc. For instance, the metatable naming/querying system from the
aux. lib. Similarly, in transitioning a file saving/loading system I threw
together from Lua4 to Lua5 I replaced a table of specializations per
userdata tag with entries in the metatable of the userdata "types". Anyway,
I was just curious what other uses for "specialization" methods people have
thought up.
-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br]On Behalf Of Roberto
Ierusalimschy
Sent: Wednesday, November 19, 2003 5:33 AM
To: Lua list
Subject: Re: Naming userdata objects
* http://www.lua.org/manual/5.0/manual.html#5.1
> tostring (e)
> [...]
>
> If the metatable of e has a "__tostring" field, tostring calls the
> corresponding value with e as argument, and uses the result of the call
> as its result.
-- Roberto