[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: basic type support (was: "namespaces" ?)
- From: "Peter Prade" <prade@...>
- Date: Mon, 22 Apr 2002 16:53:58 +0200
> Just to remind you, Lua 4.0 already had support for this kind of OO
> programming with basic types. For instance,
>
> settagmethod(tag(""), "gettable", function (a,b)
> return getglobal('str'..b)
> end)
>
> > ansiStr = "Hello"
> > print(ansiStr:lower())
now this is cool!!
and i was always thinking that this cannot be done, because the reference
manual says:
``gettable'':
called whenever Lua accesses an indexed variable. This method cannot be set
for tables with the default tag.
since i cannot set this tagmethod for "vanilla" tables, i never thought i
could set it for other "vanilla" types.
Cheers,
Peter