[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: parser hacking: conditional fields
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 1 Mar 2013 14:07:59 +0200
On Fri, Mar 1, 2013 at 1:31 PM, Eike Decker <zet23t@googlemail.com> wrote:
> Have you considered metatable trickery?
Or just messing with nil's metatable, as lhf once suggested?
debug.setmetatable(nil,{
__index = function(t,k) return nil end
})
a = {}
print(a.b.c)
-->
nil
Evil and cunning; in an ideal world, a module writer could mess with
one of the standard metatables and this would _only_ apply to that
environment. A _relatively_ benign global adjustment, but one that
makes a common class of error more obscure.
steve d.