lua-users home
lua-l archive

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


2016-08-07 6:58 GMT+02:00 Tim Hill <drtimhill@gmail.com>:

> table.len = function(t) return #t end

But

table.frontier = function(t)
   local mt = getmetatable(t)
   local len = #setmetatable(t)
   setmetatable(t,mt)
   return len
end

is less trivial, and sufficiently cumbersome to jusitfy implementation
at a lower level.