2007-06-08 05:11:37 +00:00
|
|
|
package lua.value;
|
|
|
|
|
|
|
|
|
|
import lua.StackState;
|
|
|
|
|
|
|
|
|
|
public class LString extends LValue {
|
|
|
|
|
|
|
|
|
|
final String m_string;
|
|
|
|
|
|
|
|
|
|
public LString(String string) {
|
|
|
|
|
this.m_string = string;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-10 22:53:09 +00:00
|
|
|
public boolean equals(Object o) {
|
|
|
|
|
return o != null && o instanceof LString && m_string.equals(((LString)o).m_string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
|
return m_string.hashCode();
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-08 05:11:37 +00:00
|
|
|
// TODO: what to do with LuaState?
|
|
|
|
|
public LString(StackState l, String string) {
|
|
|
|
|
this(string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String luaAsString() {
|
|
|
|
|
return m_string;
|
|
|
|
|
}
|
2007-06-10 19:49:47 +00:00
|
|
|
|
|
|
|
|
/** Built-in opcode LEN, for Strings and Tables */
|
|
|
|
|
public LValue luaLength() {
|
|
|
|
|
return new LInteger( m_string.length() );
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-08 05:11:37 +00:00
|
|
|
}
|