[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: the ambiguity in 5.0 reference manual
- From: PA <petite.abeille@...>
- Date: Tue, 30 May 2006 08:29:49 +0200
On May 30, 2006, at 08:09, google wrote:
Now,according to the reference manual,the somedata is a table.
But really it is a userdata. Is there something Wrong?
It's a bit more exotic then that as any object can have a metatable
associated with it:
local aString = "abcd"
local aFunction = aString[ "upper" ]
print( aFunction( aString ) )
-- or print( aString.upper( aString ) )
-- or print( aString:upper() )
> ABCD
local aNil = nil
debug.setmetatable( aNil, { __index = { toString = function( aValue )
return tostring( aValue ):upper() end } } )
print( aNil:toString() )
> NIL
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/