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:
@@ -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) )
|
||||||
|
|||||||
Reference in New Issue
Block a user