lua-users home
lua-l archive

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

On Sun, Sep 19, 2010 at 1:52 PM, Tom N Harris <> 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
> lookup.

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.