[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Learning Lua
- From: Jonathan Castello <twisolar@...>
- Date: Sun, 19 Sep 2010 14:14:42 -0700
On Sun, Sep 19, 2010 at 1:52 PM, Tom N Harris <email@example.com> wrote:
> This has me puzzled. The above two code snippets are functionally
> equivalent, right? So why does the metamethod trigger "C stack overflow"
> while the first one doesn't? They should both have the same recursion depth.
> I can't find any hidden function calls that may be invoked by the metatable
Maybe metamethod calls have an extra C-call that precede them? The Lua
manual shows (in Lua pseudocode) how the metamethod handling operates,
and it seems like that might be done in a separate function, before
the metamethod itself is called. (But I've never looked at the Lua
source so this is just conjecture.)
For the record, the value of 'x' it dies on is 35655.