[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Translating from a VERY "loose" language
- From: Steve Heller <steveheller@...>
- Date: Mon, 11 Jun 2007 12:36:02 -0700 (PDT)
--- PA <petite.abeille@gmail.com> wrote:
>
> On Jun 11, 2007, at 19:22, Timon Christl wrote:
>
> > Note that the manual says the metatable for
> > non-table values can only be changed in C code.
>
> Or through the debug module:
>
> debug.setmetatable( nil, { __index = function( self,
> aKey ) return aKey
> end } )
>
> print( ( nil ).dwim )
>
> > dwim
Thanks for the example. But what is the syntax for
setting the metatable for numbers? I tried this:
debug.setmetatable( number,
{ __eq = function( a, b )
return a <= b and b <= a
end
}
)
print( 3 == 4 )
but __eq doesn't seem to be called.