Make some errors compatible with native lua
This commit is contained in:
@@ -839,7 +839,7 @@ abstract public class LuaValue extends Varargs {
|
|||||||
* @see #toString()
|
* @see #toString()
|
||||||
* @see #TSTRING
|
* @see #TSTRING
|
||||||
*/
|
*/
|
||||||
public String optjstring(String defval) { argerror("String"); return null; }
|
public String optjstring(String defval) { argerror("string"); return null; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that optional argument is a string or number and return as
|
* Check that optional argument is a string or number and return as
|
||||||
@@ -1018,7 +1018,7 @@ abstract public class LuaValue extends Varargs {
|
|||||||
* @see #optint(int)
|
* @see #optint(int)
|
||||||
* @see #TNUMBER
|
* @see #TNUMBER
|
||||||
*/
|
*/
|
||||||
public int checkint() { argerror("int"); return 0; }
|
public int checkint() { argerror("number"); return 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that the value is numeric, and convert and cast value to int, or
|
* Check that the value is numeric, and convert and cast value to int, or
|
||||||
@@ -3434,7 +3434,7 @@ abstract public class LuaValue extends Varargs {
|
|||||||
return h.call(this, op1);
|
return h.call(this, op1);
|
||||||
if (LuaValue.LE.raweq(tag) && (!(h = metatag(LT)).isnil() || !(h = op1.metatag(LT)).isnil()))
|
if (LuaValue.LE.raweq(tag) && (!(h = metatag(LT)).isnil() || !(h = op1.metatag(LT)).isnil()))
|
||||||
return h.call(op1, this).not();
|
return h.call(op1, this).not();
|
||||||
return error("attempt to compare " + tag + " on " + typename() + " and " + op1.typename());
|
return error("bad argument: attempt to compare " + tag + " on " + typename() + " and " + op1.typename());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1050,7 +1050,7 @@ class UnaryBinaryOperatorsTest {
|
|||||||
LuaValue.class.getMethod(op, new Class[] { LuaValue.class }).invoke(a, new Object[] { b });
|
LuaValue.class.getMethod(op, new Class[] { LuaValue.class }).invoke(a, new Object[] { b });
|
||||||
} catch (InvocationTargetException ite) {
|
} catch (InvocationTargetException ite) {
|
||||||
String actual = ite.getTargetException().getMessage();
|
String actual = ite.getTargetException().getMessage();
|
||||||
if ((!actual.startsWith("attempt to compare")) || actual.indexOf(type) < 0)
|
if ((!actual.contains("attempt to compare")) || actual.indexOf(type) < 0)
|
||||||
fail("(" + a.typename() + "," + op + "," + b.typename() + ") reported '" + actual + "'");
|
fail("(" + a.typename() + "," + op + "," + b.typename() + ") reported '" + actual + "'");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
fail("(" + a.typename() + "," + op + "," + b.typename() + ") threw " + e);
|
fail("(" + a.typename() + "," + op + "," + b.typename() + ") threw " + e);
|
||||||
|
|||||||
Reference in New Issue
Block a user