CC: Tweaked

CC: Tweaked

42M Downloads

ArrayIndexOutOfBoundsException when setting entries on weak tables

migeyel opened this issue · 3 comments

commented

Minecraft Version

1.20.x

Version

1.109.4, 1.109.5

Details

The following code errors pretty reliably when it shouldn't:

local t = setmetatable({}, { __mode = "k" })
for _ = 1, 1e6 do t[{}] = {} end

This looks like a regression. I'm not able to reproduce it on 1.109.3.

commented

I seem to remember that weak tables are not implemented, there are a few things with memory management/garbage collection that PUC Lua provides but Cobalt (and thus CC) doesn't due to how Cobalt is implemented on Java.

commented

Weak tables are implemented, they just have somewhat broken semantics. No, this is a recent regression caused by cc-tweaked/Cobalt@5aebd88.

commented

Thanks for the report, that was an annoying one - I was so careful when porting to avoid this specific bug, and it still happened 🤦.