As the title says. Make a metatable with a populated table and run the generalized iterator on it. According to the Developer API, this should fire __iter
. It will, but when __iter
is absent, it instead fires __call
, which isn’t entirely useful in the case of metatable usage, requiring me to perform checks that the table isn’t called with nil
. It also means I cannot provide the generalized iterator, I have to return next, self, nil
, which will cause an inescapable loop and timeout the script. next() apparently counts as a __call, or the generalized iteration does in general, causing an infinite loop. A workaround is to implement __iter
anyway, but I don’t want to do that; I want to use the actual generalized iteration because I find it to be the most performant typically.
Clarification for my sake or investigating this to remove the __call altogether for generalized iteration is requested.
Example below. Place is attached too, you can just open it and see what I mean.
^ note in the above, the output is from when I uncommented the return next, t, nil. Otherwise it will do the __call output and nothing in the for loop.
bug example 4-9-2025 mewow.rbxl (55.9 KB)
System info:
CPU
Intel(R) Core(TM) i7-14700K @ 5.0GHz with a base of 3.4
Memory
32.0 GB
Disk 0 (C:)
Samsung SSD 870 EVO 1TB
GPU 1
NVIDIA GeForce RTX 4070 Ti
Driver version: 32.0.15.7260
Driver date: 2/25/2025
DirectX version: 12 (FL 12.1)
Physical location: PCI bus 1, device 0, function 0
Utilization 1%
Dedicated GPU memory 1.8/12.0 GB
Shared GPU memory 0.1/15.9 GB
GPU Memory 1.9/27.9 GB
Expected behavior
__call should not be triggered, its supposed to be when the table is, from a lua dev’s POV, called like a function per the API wiki. Im not doing that, and thus I shouldn’t be forced to use pairs()
or returning next()
. Given generalized iteration is more performant. It locks me out entirely from using generalized iteration just because I’m using __call.