Let luaAsInt() return sensible values for non-numeric data.

This commit is contained in:
James Roseborough
2007-08-01 06:11:43 +00:00
parent 32dcbaca3a
commit 01c5595fd6
2 changed files with 4 additions and 1 deletions

View File

@@ -24,6 +24,10 @@ public final class LBoolean extends LValue {
return m_value;
}
public final int luaAsInt() {
return m_value? 1: 0;
}
public final static LBoolean valueOf(boolean value) {
return value? TRUE: FALSE;
}

View File

@@ -105,7 +105,6 @@ public class LValue {
/** Return value as an integer */
public int luaAsInt() {
luaUnsupportedOperation();
return 0;
}