iwas tryna do a thing where if a new index is added to a table, do something then actually add it because if you try to do it with __newindex it just doenst do that
i used __newindex to do that but i still need the added item to PERSIST in the table so it actually gets added
when i try to do that it just gives me “C stack overflow” from what i heard its when like you try adding too many things to a table that it overflows memory so it just throws out that as in panic, which is like usually done when you do a loop where like basically youre calling the function in itself, so it enters a loop of “i got called, i should call myself again, i called myself, i will call myself again” so it just never ends
A C stack overflow in Roblox Lua means the call stack limit was exceeded due to infinite or uncontrolled recursion. It does not mean memory overflow from too many table entries.
In your case, it happens because your __newindex metamethod is assigning back into the same table in a way that triggers __newindex again. That creates this loop.
Your understanding about recursion causing it is correct. The memory explanation is not.
A few emojis so you know I’m not a jerk. Just straightforward.
That “In a way” was the pressed[key] .. Forums is a hard game.
When you do pressed[key] = val inside the __newindex function, it calls itself again forever → C stack overflow. Try use rawset to actually add the value without triggering the metatable.