lua-users home
lua-l archive

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


Am 03.05.2014 08:12 schröbte Dirk Laurie:
2014-05-03 0:55 GMT+02:00 Petite Abeille <petite.abeille@gmail.com>:

http://lua-users.org/lists/lua-l/2006-03/msg00691.html

What about having the math library as the default metatable for number?

I asked my two old friends Pro and Con to discuss it over a beer.


Con: And I get confused when arguments are the wrong way round.
   As in x:log(10) instead of log(x,10).

There are also `math.max` and `math.min` which don't have a clear self. E.g.:

    n:max( 3, 2, 1 )      --> 4    ...   Huh?!

And `math.random` which has an optional self.

On the plus side: It's unlikely that someone will want to sandbox the math functions ...


Philipp