lua-users home
lua-l archive

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


The problem seems, to me, that you can't properly define this solution.

What if a certain metatable gives something back for only certain non-existing members. Should these then be a non-existing entry, or not?

By doing the null-check yourself you can 
a) operate optimal when you don't care
b) do something very specific when you do.

So the definition of the problem you're trying to solve is use-case specific. This is why metatables are cool and a fundamental concept. 
Wrap all your table creation with a metatable and you can have what you seem to desire.

Kaj