Improve compatibility with lua 5.2.

This commit is contained in:
James Roseborough
2012-09-20 05:30:41 +00:00
parent 4d8877e56b
commit 9ae6767f76
2 changed files with 14 additions and 13 deletions

View File

@@ -2970,11 +2970,12 @@ public class LuaValue extends Varargs {
* @see #lteq(LuaValue)
*/
public LuaValue comparemt( LuaValue tag, LuaValue op1 ) {
if ( type() == op1.type() ) {
LuaValue h = metatag(tag);
if ( !h.isnil() && h == op1.metatag(tag) )
return h.call(this, op1);
}
LuaValue h = metatag(tag);
if ( !h.isnil() )
return h.call(this, op1);
h = op1.metatag(tag);
if ( !h.isnil() )
return h.call(this, op1);
return error("attempt to compare "+tag+" on "+typename()+" and "+op1.typename());
}