[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Arrays and Tables
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 26 Jun 2017 07:43:52 +0200
2017-06-26 3:26 GMT+02:00 Italo Maia <italo.maia@gmail.com>:
> I always thought lua approach on arrays was quite clever. I miss the fact
> that "non-arrays" cannot be counted with #, but beside that, all is fine.
Oh, but they can.
tbl = setmetatable({a="a",b="b"},{
__len = function(tbl)
local n=0
for k in pairs(tbl) do n=n+1 end
return n
end})