diff --git a/.cvsignore b/.gitignore similarity index 65% rename from .cvsignore rename to .gitignore index 908e4e3e..d7642856 100644 --- a/.cvsignore +++ b/.gitignore @@ -1,8 +1,8 @@ -bin -target -build -lib -jit +bin/ +target/ +build/ +lib/ +jit/ *.ser *.gz *.jar diff --git a/README.html b/README.md similarity index 98% rename from README.html rename to README.md index cd0f790a..f289746f 100644 --- a/README.html +++ b/README.md @@ -1,21 +1,18 @@ - - +# This is a fork! +
+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.
+-- Benjamin P. Jung, Jan. 26th 2018 +
- -Getting Started with LuaJ - - - - - - -
-

- - -Getting Started with LuaJ - -

+

Getting Started with LuaJ

James Roseborough, Ian Farmer, Version 3.0.1

diff --git a/src/core/org/luaj/vm2/lib/StringLib.java b/src/core/org/luaj/vm2/lib/StringLib.java index 1189fc7e..833153aa 100644 --- a/src/core/org/luaj/vm2/lib/StringLib.java +++ b/src/core/org/luaj/vm2/lib/StringLib.java @@ -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) {