Fix work with weak tables.

```
a = {}; setmetatable(a, {__mode = 'vk'});
a[1], a[2], a[3] = {}, {}, {};
for k, v in pairs(a) do
	print(k, v)
end
print('ok')
```
This commit is contained in:
Enyby
2019-12-15 20:39:26 +02:00
parent ca64666242
commit d201bc3012

View File

@@ -472,7 +472,8 @@ public class LuaTable extends LuaValue implements Metatable {
} }
} }
if ( checkLoadFactor() ) { if ( checkLoadFactor() ) {
if ( key.isinttype() && key.toint() > 0 ) { if ( (m_metatable == null || !(m_metatable.useWeakKeys() || m_metatable.useWeakValues()))
&& key.isinttype() && key.toint() > 0 ) {
// a rehash might make room in the array portion for this key. // a rehash might make room in the array portion for this key.
rehash( key.toint() ); rehash( key.toint() );
if ( arrayset(key.toint(), value) ) if ( arrayset(key.toint(), value) )