diff --git a/README.html b/README.html index 19bb8fa3..12b224dd 100644 --- a/README.html +++ b/README.html @@ -17,7 +17,7 @@ Getting Started with LuaJ -James Roseborough, Ian Farmer, Version 2.0-beta2 +James Roseborough, Ian Farmer, Version 2.0
Copyright © 2009-2010 Luaj.org. @@ -43,13 +43,10 @@ Freely available under the terms of the
- -This is a beta release for a luaj 2.0. The most recent stable release is 1.0.3 -
From the main distribution directory line type:
- java -cp lib/luaj-jse-2.0-beta2.jar lua examples/lua/hello.lua + java -cp lib/luaj-jse-2.0.jar lua examples/lua/hello.lua
@@ -87,34 +86,50 @@ You should see the following output: hello, world -
From the main distribution directory line type:
- java -cp lib/luaj-jse-2.0-beta2.jar luac examples/lua/hello.lua - java -cp lib/luaj-jse-2.0-beta2.jar lua luac.out + java -cp lib/luaj-jse-2.0.jar luac examples/lua/hello.lua + java -cp lib/luaj-jse-2.0.jar lua luac.out
The compiled output "luac.out" is lua bytecode and should run and produce the same result. -
-Luaj can compile to lua bytecode if the bcel library is on the class path. From the main distribution directory line type: +Luaj can compile to lua source code to Java source code: + +
+ java -cp lib/luaj-jse-2.0.jar lua2java -s examples/lua -d . hello.lua + javac -cp lib/luaj-jse-2.0.jar hello.java + java -cp "lib/luaj-jse-2.0.jar;." lua -l hello ++ +
+The output hello.java is Java source, that implements the logic in hello.lua directly. +Once hello.java is compiled into hello.class it can be required and used in place of the original lua script, but with better performance. +There are no additional dependencies for compiling or running source-to-source compiled lua. + +
+Luaj can compile lua sources or binaries directly to java bytecode if the bcel library is on the class path. From the main distribution directory line type:
ant bcel-lib - java -cp "lib/luaj-jse-2.0-beta2.jar;lib/bcel-5.2.jar" luajc -s examples/lua -d . hello.lua - java -cp "lib/luaj-jse-2.0-beta2.jar;." lua -l hello + java -cp "lib/luaj-jse-2.0.jar;lib/bcel-5.2.jar" luajc -s examples/lua -d . hello.lua + java -cp "lib/luaj-jse-2.0.jar;." lua -l hello
The output hello.class is Java bytecode, should run and produce the same result. There is no runtime dependency on the bcel library, -but the compiled classes must be in the class path at runtime. +but the compiled classes must be in the class path at runtime, unless runtime jit-compiling via luajc and bcel are desired (see later sections).
@@ -140,7 +155,7 @@ A simple example may be found in
-You must include the library lib/luaj-jse-2.0-beta2.jar in your class path. +You must include the library lib/luaj-jse-2.0.jar in your class path.
-You must include the library lib/luaj-jme-2.0-beta2.jar in your midlet jar. +You must include the library lib/luaj-jme-2.0.jar in your midlet jar.
An ant script to build and run the midlet is in @@ -194,7 +209,20 @@ that are needed and omitting the line: -
+To compile from lua sources to Java sources for all lua loaded at runtime, +install the Lua2Java compiler after globals have been created using: + +
+ org.luaj.vm2.jse.lua2java.Lua2Java.install(); ++ +This uses the system Java compiler to compile from Java source to Java bytecode, +and cannot compile lua binary files containing lua bytecode at runtime. + +
To compile from lua to Java bytecode for all lua loaded at runtime, @@ -228,7 +256,7 @@ The standard use of JSR-233 scripting engines may be used: All standard aspects of script engines including compiled statements should be supported.
-You must include the library lib/luaj-jse-2.0-beta2.jar in your class path. +You must include the library lib/luaj-jse-2.0.jar in your class path.
A working example may be found in @@ -351,7 +379,7 @@ The following lua script will open a swiing frame on Java SE:
See a longer sample in src/test/res/swingapp.lua for details, or try running it using:
- java -cp lib/luaj-jse-2.0-beta2.jar lua src/test/res/swingapp.lua + java -cp lib/luaj-jse-2.0.jar lua src/test/res/swingapp.lua
@@ -417,23 +445,19 @@ and LuaForge:
Known Issues
|