Type coercion for luajava package, make luajava an "addon"

This commit is contained in:
James Roseborough
2007-06-24 15:04:19 +00:00
parent 1d7793f8e6
commit 93fc4699a9
18 changed files with 574 additions and 142 deletions

View File

@@ -6,17 +6,23 @@ import lua.StackState;
public class LString extends LValue {
final String m_string;
final int m_hash;
public LString(String string) {
this.m_string = string;
this.m_hash = string.hashCode();
}
public boolean equals(Object o) {
return o != null && o instanceof LString && m_string.equals(((LString)o).m_string);
if ( o != null && o instanceof LString ) {
LString s = (LString) o;
return m_hash == s.m_hash && m_string.equals(s.m_string);
}
return false;
}
public int hashCode() {
return m_string.hashCode();
return m_hash;
}
// TODO: what to do with LuaState?