[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The problem with or and false
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 29 Mar 2006 15:25:25 -0300
> Say, I have three tables, A, B and C. I want user to transparently
> read from them as from single table, first looking to A, then to B,
> and then to C, and raising error if there is no requested key.
> Do anyone know more elegant solution?
How about this:
A= { a=10 }
B= { b=20 }
C= { c=30 }
setmetatable(A, { __index=B} )
setmetatable(B, { __index=C} )
setmetatable(C, { __index=error} )
print(A.a)
print(A.b)
print(A.c)
print(A.z)
--lhf