[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A metatable for nil?
- From: Paul K <paul@...>
- Date: Fri, 13 Nov 2015 04:14:01 +0000
> There are no doubt good reasons, but why no metatable for nil?
There is, just need to use debug.setmetatable:
http://comments.gmane.org/gmane.comp.lang.lua.general/109403
Paul.
On Thu, Nov 12, 2015 at 8:01 PM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> There are no doubt good reasons, but why no metatable for
> nil? If you forget to require a library you will have
> lots of nil values being applied as functions or being indexed
> as tables. It would be nice to handle the resulting
> errors in a controlled way by assigning to
> (getmetatable ( )).__call and (getmetatable ( )).__index.
>
> I woke up in the middle of the night to send this query,
> so apologies if the brain is not firing on all cylinders.
> --
> Gavin Wraith (gavin@wra1th.plus.com)
> Home page: http://www.wra1th.plus.com/
>