Re: Lua 5.3 `ipairs` considered perilous
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua 5.3 `ipairs` considered perilous
- From: Sergey Zakharchenko <doublef.mobile@...>
- Date: 2016年2月16日 20:29:47 +0300
Hello Dirk,
2016年02月16日 18:19 GMT+03:00 Dirk Laurie <dirk.laurie@gmail.com>:
> Example 2. Plugging holes in lists of numbers.
> x = setmetatable({5,9,nil,6,nil,nil,3,1},
> {__index = load"return 0/0",
> __len=load"return 8"})
> print(table.concat(x," "))
> However, try this:
>> for k,v in ipairs(y) do print(k,v) end
> and see what happens.
Don't the supplied __len and __index explicitly supply contradictory data?
Best regards,
--
DoubleF