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:
Enyby
2019-12-16 15:31:13 +02:00
parent d201bc3012
commit d6737c0bb3

View File

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