lua-users home
lua-l archive

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


Alexander Gladysh wrote:
Unfortunately, I need to have all tables in "honest" state, so such
joined usage would be completely transparent for their other users.

how about a generic join ? (not as fast as your function approach, i think)

join = function(...)
  local t1 = arg -- {...} for 5.1
  return setmetatable({},
    {
     __index = function(t, k)
         for tt,i in ipairs(t1) do
            local ret = tt[k]
            if (ret~=nil) then return ret end
         end
         error("Not Found" .. k )
      end;
     -- Skip __newindex for clarity.
    }
end

Adrian.