Improve work with weak keys.
```
for _, m in ipairs({'', 'k', 'kv', 'v'}) do
print('test', m)
a = {}; setmetatable(a, {__mode = m});
a[1], a[2], a[3] = {}, {}, {};
for k, v in pairs(a) do
print(k, v)
end
end
print('ok')
```
This commit is contained in:
@@ -472,7 +472,7 @@ public class LuaTable extends LuaValue implements Metatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( checkLoadFactor() ) {
|
if ( checkLoadFactor() ) {
|
||||||
if ( (m_metatable == null || !(m_metatable.useWeakKeys() || m_metatable.useWeakValues()))
|
if ( (m_metatable == null || !m_metatable.useWeakValues())
|
||||||
&& key.isinttype() && key.toint() > 0 ) {
|
&& 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() );
|
||||||
|
|||||||
Reference in New Issue
Block a user