lua-users home
lua-l archive

Re: Lookup nil table index

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


> 	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

AltStyle によって変換されたページ (->オリジナル) /