RE: Interesting stack overflow in Lua 5.3
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: RE: Interesting stack overflow in Lua 5.3
- From: 张睿 <zrui16@...>
- Date: Thu, 3 Sep 2015 11:12:09 -0700
I think it's because ipairs now respects __index metamethod in 5.3.
-------- Original message --------
From: Paul K <paul@zerobrane.com>
Date: 9/3/2015 11:09 AM (GMT-08:00)
To: Lua mailing list <lua-l@lists.lua.org>
Subject: Re: Interesting stack overflow in Lua 5.3
>> I may be missing something, but "The following function" does not seem
>> to be a function. It looks like a table... (Therefore, I do not know
>> how to invoke it to cause something.)
> But I don't see how invoking it would cause something, either.
Add: setmetatable({1,2,3}, subsystem_mt).foo()
Lua 5.2 prints:
Checking 'foo' against '1'
Checking 'foo' against '2'
Checking 'foo' against '3'
metaindex.lua:7: attempt to call field 'foo' (a nil value)
But Lua 5.3 prints:
Checking 'foo' against '1'
Checking 'foo' against '2'
Checking 'foo' against '3'
Checking '4' against '1'
Checking '4' against '2'
Checking '4' against '3'
...last three lines are repeated...
metaindex.lua:3: C stack overflow
Paul.