Files
luaj/src/main/java/lua/value/LBoolean.java
Ian Farmer 635f127cd0 Add new built-in function type() that returns the name of the type of
the given value as a string. Includes test case.
2007-07-16 02:37:08 +00:00

35 lines
699 B
Java

package lua.value;
public final class LBoolean extends LValue {
public static final LBoolean TRUE = new LBoolean("true",true);
public static final LBoolean FALSE = new LBoolean("false",false);
public static final LString TYPE_NAME = new LString("boolean");
private final String m_name;
private final boolean m_value;
private LBoolean( String name, boolean value ) {
this.m_name = name;
this.m_value = value;
}
public final String luaAsString() {
return m_name;
}
public final boolean luaAsBoolean() {
return m_value;
}
public final static LBoolean valueOf(boolean value) {
return value? TRUE: FALSE;
}
public LString luaGetType() {
return TYPE_NAME;
}
}