lua-users home
lua-l archive

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


On Wed, 29 Mar 2006 22:10:01 +0400 "Alexander Gladysh"
<agladysh@gmail.com> wrote:
> local r = A[k] if r == nil then
>   r = B[k] if r == nil then
>     r = C[k] if r == nil then
>       error("Not found")
>     end
>   end
> end
> return r

Is that code so ugly ?
You also can try :
	for _,r in pairs{ A[k], B[k], C[k]} do
		return r
	end
	return error("Not found")

-- 
Mildred       <xmpp:mildred@jabber.fr> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]