Fixes for string.rep, string.byte, string.lower, and string.upper. Also
factor out negative index handling to separate function, posrelat (to match C Lua). When converting numbers to strings, see if the double value can be represented exactly as a long, and if so format the string as an integer. With these changes the standard test case "strings.lua" runs to line 104 (over half way through!), where it uses string.format.
This commit is contained in:
@@ -15,7 +15,13 @@ public class LDouble extends LNumber {
|
||||
}
|
||||
|
||||
public LString luaAsString() {
|
||||
return LString.valueOf( m_value );
|
||||
long l = (long) m_value;
|
||||
if ( m_value == (double) l ) {
|
||||
// TODO: is this a good idea?
|
||||
return new LString( Long.toString( l ) );
|
||||
} else {
|
||||
return LString.valueOf( m_value );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInteger() {
|
||||
|
||||
Reference in New Issue
Block a user