Propogate metatables to weak tables on creation.

This commit is contained in:
James Roseborough
2009-01-28 18:38:40 +00:00
parent b3cf6171b0
commit d690d5b210

View File

@@ -276,7 +276,9 @@ public class LTable extends LValue {
org.luaj.vm.LTable t = (org.luaj.vm.LTable) metatable; org.luaj.vm.LTable t = (org.luaj.vm.LTable) metatable;
LValue m = t.get(TM_MODE); LValue m = t.get(TM_MODE);
if ( m.isString() && m.toJavaString().indexOf('v')>=0 ) { if ( m.isString() && m.toJavaString().indexOf('v')>=0 ) {
return new LWeakTable(this); LTable w = new LWeakTable(this);
w.m_metatable = t;
return w;
} }
this.m_metatable = t; this.m_metatable = t;
} else { } else {