Re: Lookup nil table index
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lookup nil table index
- From: roberto@... (Roberto Ierusalimschy)
- Date: 2006年11月30日 14:03:04 -0200
> a = thing.foo.bar.this.that
>
> When one of the indicated elements does not exist, an error is generated
> for apperent reasons: attempt to index nil value.
You can achive this by setting an __index metamethod for nil, but you
will have to set it through C. (More exactly, you need C to set a
metatable for nil. After that you can use Lua to set the metamethod.)
-- Roberto