diff --git a/README.html b/README.html new file mode 100644 index 00000000..e2393e2e --- /dev/null +++ b/README.html @@ -0,0 +1,259 @@ + + + +
++ +Copyright © 2007-2008 Luaj.org. +Freely available under the terms of the +Luaj license. + +
+ +examples +· +concepts + + +
+ +
+From the main distribution directory line type: + +
+ java -cp luaj-j2se-${VERS}.jar lua src/test/res/test4.lua
+
+
++You should see the following output: +
+ 40 ++ +
+From the main distribution directory line type: + +
+ java -cp luaj-j2se-${VER}.jar luac src/test/res/test4.lua
+ java -cp luaj-j2se-${VER}.jar lua luac.out
+
+
++The compiled output should run and produce the same result. + +
+The following pattern is used within J2SE + +
+ import org.luaj.platform.*; + import org.luaj.vm.*; + + String script = "main.lua"; + Platform.setPlatform( new J2sePlatform() ); + LuaState vm = Platform.newLuaState(); + vm.getglobal( "dofile" ); + vm.pushstring( script ); + vm.call( 1, 0 ); ++ +
+You must include the library lib/luaj-j2se-${VER}.jar in your class path. + +
+Additional usage may be found in +
+ src/sample/LuaRunner.java ++ +
+The following pattern is used within MIDlets: + +
+ import org.luaj.platform.*; + import org.luaj.vm.*; + + String script = "main.lua"; + Platform.setPlatform( new J2mePlatform() ); + LuaState vm = Platform.newLuaState(); + vm.getglobal( "dofile" ); + vm.pushstring( script ); + vm.call( 1, 0 ); ++ +
+The file must be a resource within within the midlet jar for dofile() to find it. +Any files included via require() must also be part of the midlet resources. + +
+You must include the library lib/luaj-j2me-${VER}.jar in your midlet jar. +They can be obfuscated if desired. + +
+To include it, include the following after the Platform is created, +but before the script is executed: +
+ org.luaj.compiler.LuaC.install(); ++ +
+The standard use of JSR-233 scripting engines may be used: + +
+ ScriptEngineManager mgr = new ScriptEngineManager();
+ ScriptEngine e = mgr.getEngineByExtension(".lua");
+ e.put("x", 25);
+ e.eval("y = math.sqrt(x)");
+ System.out.println( "y="+e.get("y") );
+
+
++All standard aspects of script engines including compiled statements should be supported. + +
+You must include the library lib/luaj-j2se-${VER}.jar in your class path. + +
+A working example may be found in +
+ src/script/ScriptEngineSample.java ++ + +
+To include the luajava library, include a line in your script such as: + +
+ require( "org.luaj.lib.j2se.Luajava" ) ++ +
+or include the following line in your startup code: + +
+ org.luaj.lib.j2se.Luajava.init( vm._G ); ++ +
+See the following example for more details: +
+ src/sample/LuajavaRunner.java ++ +
+Because reflection is required by the implementation, this is only usable from the J2SE platform. + +
+You must include the library lib/luaj-j2se-${VER}.jar in your class path. + +
+You can try sample code that creates a simple Swing UI using: +
+ java -cp luaj-j2se-${VERS}.jar lua src/test/res/swingapp.lua
+
+
+
++The following libraries are loaded by default: +
+ base + coroutine + math + package + string + table ++ +See standard lua documentation for details on the library API's + +
+ debug + io ++ +
+Other targets exist for creating distribution file an measuring code coverage of unit tests. + +
+A large array of test scripts may be found in +
+ src/test/res/*.lua ++ +
+A large set of JUnit tests are invoked by the JUnit 3 suite: +
+ src/test/java/AllTests.lua ++ +
+These tests are used for to produce code coverage statistics using build-coverage.xml.
diff --git a/build.xml b/build.xml
index a6e469b4..73ee8230 100644
--- a/build.xml
+++ b/build.xml
@@ -76,6 +76,7 @@