lua-users home
lua-l archive

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

>I personally would like to search other tables if a global cannot be found
>before returning nil.

How about this?

 settagmethod(tag(nil),"getglobal",function (name)
  return T1[name] or T2[name] or T3[name]

This searches "name" in tables T1, T2, T3 before returning nil.
(Just make sure that T1, T2, T3 are defined or you'll get loops.)