lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

Would it be possible to have the math package act as the default metatable for numbers in the same fashion as the string package is the default metatable for strings?

In other words, 5.1 (alpha) allows the following construct for strings:

( "aString" ):upper()

I would like to be able to use the same syntax for numbers as well:

( -1 ):abs()

Could lmathlib register itself as the default metatable for numbers similarely to what lstrlib's createmetatable does for string?

Is there any major drawbacks to have the math package as the default metatable for numbers?

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/