Fix format float numbers #12
10
.cvsignore → .gitignore
vendored
10
.cvsignore → .gitignore
vendored
@@ -1,8 +1,8 @@
|
||||
bin
|
||||
target
|
||||
build
|
||||
lib
|
||||
jit
|
||||
bin/
|
||||
target/
|
||||
build/
|
||||
lib/
|
||||
jit/
|
||||
*.ser
|
||||
*.gz
|
||||
*.jar
|
||||
@@ -1,21 +1,18 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
# This is a fork!
|
||||
<div style="border: 1px dotted red; margin: 1.em 0.5em; font-weight: bold; color: red;">
|
||||
This repository has been forked from the original CVS sources of Luaj.
|
||||
The commit history has been converted to make sure that the original work of
|
||||
James Roseborough and Ian Farmer is not lost.
|
||||
Unfortunately, I was not able to contact either James or Ian to hand over
|
||||
ownership of the Github organization/repo as I have originally intended to.
|
||||
The community however seems interested enough to continue work on the original
|
||||
sources and therefore I have decided to make sure that any useful pull requests
|
||||
that may add some value to the original code base shall be merged in from now
|
||||
on.<br>
|
||||
-- Benjamin P. Jung, Jan. 26th 2018
|
||||
</div>
|
||||
|
||||
<head>
|
||||
<title>Getting Started with LuaJ</title>
|
||||
<link rel="stylesheet" type="text/css" href="http://www.lua.org/lua.css">
|
||||
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<hr>
|
||||
<h1>
|
||||
<a href="README.html"><img src="http://sourceforge.net/dbimage.php?id=196139" alt="" border="0"></a>
|
||||
|
||||
Getting Started with LuaJ
|
||||
|
||||
</h1>
|
||||
<h1>Getting Started with LuaJ</h1>
|
||||
James Roseborough, Ian Farmer, Version 3.0.1
|
||||
<p>
|
||||
<small>
|
||||
@@ -343,6 +343,8 @@ public class StringLib extends TwoArgFunction {
|
||||
public final int conversion;
|
||||
public final int length;
|
||||
|
||||
public final String src;
|
||||
|
||||
public FormatDesc(Varargs args, LuaString strfrmt, final int start) {
|
||||
int p = start, n = strfrmt.length();
|
||||
int c = 0;
|
||||
@@ -390,6 +392,7 @@ public class StringLib extends TwoArgFunction {
|
||||
zeroPad &= !leftAdjust; // '-' overrides '0'
|
||||
conversion = c;
|
||||
length = p - start;
|
||||
src = strfrmt.substring(start - 1, p).tojstring();
|
||||
}
|
||||
|
||||
public void format(Buffer buf, byte c) {
|
||||
@@ -465,8 +468,13 @@ public class StringLib extends TwoArgFunction {
|
||||
}
|
||||
|
||||
public void format(Buffer buf, double x) {
|
||||
// TODO
|
||||
buf.append( String.valueOf( x ) );
|
||||
String out;
|
||||
try {
|
||||
out = String.format(src, x);
|
||||
} catch (Throwable e) {
|
||||
out = String.valueOf( x );
|
||||
}
|
||||
buf.append( out );
|
||||
}
|
||||
|
||||
public void format(Buffer buf, LuaString s) {
|
||||
|
||||
Reference in New Issue
Block a user