[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: why doesnt a = 1 work?
- From: Peter Odding <xolox@...>
- Date: Wed, 23 May 2007 15:28:05 +0200
Markus Heukelom wrote:
However, I agree this might have some other (ugly) repercussions not
immediately obvious at this moment.
(In fact, to implement this behavior, I would have to change the __newindex
methods of the nil, number, string, etc matetable (can only in c), right?
Not that I will do that - just for the idea.)
Apart from whether it's possible to set a metatable for nil (never tried), note
that you'd only be able to do this for scalars, i.e. not for tables and
userdata, because there's no `global' metatable for these types.
About this concept in general, I don't think it would fit Lua very well. PHP
allows it, and that's caused me a few hard to find bugs.
- Peter Odding