[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: "nesting" metatables
- From: "Soni L." <fakedme@...>
- Date: Wed, 30 Dec 2015 15:00:45 -0200
On 30/12/15 02:17 PM, Roberto Ierusalimschy wrote:
On Fri, Dec 25, 2015 at 12:00 AM, Jonathan Goble <email@example.com> wrote:
On Thu, Dec 24, 2015 at 3:54 PM, Egor Skriptunoff
On Thu, Dec 24, 2015 at 12:29 PM, Jonathan Goble <firstname.lastname@example.org>
This metatable chaining could theoretically continue indefinitely.
The nested metatable limit is 2000 levels for Lua 5.3 (and 100 for
Hence "theoretically". :)
I figured there were recursion limits, as in practice stack overflow
become a concern.
It seems that nesting of "__index" metamethods results in tail calls.
The nesting of "__index" metamethods is done in a C loop, with no
calls at all. The limit is there only to avoid infinite loops (with
a table inheriting from itself).
I think they meant metamethods as in
mt.__index = function(t, k) return t.t2[k] end
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.