lua-users home
lua-l archive

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


Thanks, that really helps.

在 2017年1月17日,下午10:12,云风 Cloud Wu <cloudwu@gmail.com> 写道:

hz <hz@fiosoftware.com>于2017年1月18日周三 下午1:43写道:
just a little inconvenient when used with: 

for k, v in pairs(obj) do … end

the keys in the realobj will be ignored. It's a known issue:

Why don't pairs() and ipairs() obey an __index metamethod
http://lua-users.org/lists/lua-l/2007-09/msg00374.html

You can use __pairs metamethod like this :

__pairs = function(t) return next, realobj, nil end