Fix lua-to-java type coercion.

This commit is contained in:
James Roseborough
2008-05-28 17:22:55 +00:00
parent 03224d7da3
commit 914806afb4

View File

@@ -59,7 +59,7 @@ public class CoerceLuaToJava {
}; };
Coercion byteCoercion = new Coercion() { Coercion byteCoercion = new Coercion() {
public Object coerce(LValue value) { public Object coerce(LValue value) {
return value.toJavaByte(); return new Byte( value.toJavaByte() );
} }
public int score(LValue value) { public int score(LValue value) {
if ( value instanceof LInteger ) if ( value instanceof LInteger )
@@ -71,7 +71,7 @@ public class CoerceLuaToJava {
}; };
Coercion charCoercion = new Coercion() { Coercion charCoercion = new Coercion() {
public Object coerce(LValue value) { public Object coerce(LValue value) {
return value.toJavaChar(); return new Character( value.toJavaChar() );
} }
public int score(LValue value) { public int score(LValue value) {
if ( value instanceof LInteger ) if ( value instanceof LInteger )
@@ -83,7 +83,7 @@ public class CoerceLuaToJava {
}; };
Coercion shortCoercion = new Coercion() { Coercion shortCoercion = new Coercion() {
public Object coerce(LValue value) { public Object coerce(LValue value) {
return value.toJavaShort(); return new Short( value.toJavaShort() );
} }
public int score(LValue value) { public int score(LValue value) {
if ( value instanceof LInteger ) if ( value instanceof LInteger )
@@ -109,7 +109,7 @@ public class CoerceLuaToJava {
}; };
Coercion longCoercion = new Coercion() { Coercion longCoercion = new Coercion() {
public Object coerce(LValue value) { public Object coerce(LValue value) {
return value.toJavaLong(); return new Long( value.toJavaLong() );
} }
public int score(LValue value) { public int score(LValue value) {
if ( value instanceof LInteger ) if ( value instanceof LInteger )