diff --git a/README.html b/README.html index e2393e2e..a3a481cd 100644 --- a/README.html +++ b/README.html @@ -14,7 +14,6 @@
You must include the library lib/luaj-j2se-${VER}.jar in your class path. +
+A working example may be found in +
+ src/sample/SampleJ2seMain.java ++
Additional usage may be found in
@@ -102,8 +108,9 @@ The following pattern is used within MIDlets: import org.luaj.vm.*; String script = "main.lua"; - Platform.setPlatform( new J2mePlatform() ); + Platform.setInstance( new J2meMidp20Cldc11Platform( midlet ) ); LuaState vm = Platform.newLuaState(); + org.luaj.compiler.LuaC.install(); vm.getglobal( "dofile" ); vm.pushstring( script ); vm.call( 1, 0 ); @@ -128,6 +135,9 @@ but before the script is executed: org.luaj.compiler.LuaC.install();+
+To omit the compiler, omit this line from your startup code. +
diff --git a/src/sample/org/luaj/sample/SampleJ2seMain.java b/src/sample/org/luaj/sample/SampleJ2seMain.java new file mode 100644 index 00000000..c23bbeea --- /dev/null +++ b/src/sample/org/luaj/sample/SampleJ2seMain.java @@ -0,0 +1,16 @@ +package org.luaj.sample; +import org.luaj.platform.*; +import org.luaj.vm.*; + +public class SampleJ2seMain { + + public static void main(String[] args) { + String script = (args.length>0? args[0]: "src/test/res/swingapp.lua"); + Platform.setInstance( new J2sePlatform() ); + LuaState vm = Platform.newLuaState(); + org.luaj.compiler.LuaC.install(); + vm.getglobal( "dofile" ); + vm.pushstring( script ); + vm.call( 1, 0 ); + } +}