Add ant target to install to maven, sample maven program.
This commit is contained in:
25
examples/maven/src/main/java/acme/App.java
Normal file
25
examples/maven/src/main/java/acme/App.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package acme;
|
||||
|
||||
import org.luaj.vm2.Globals;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.jse.JsePlatform;
|
||||
|
||||
/**
|
||||
* Sample source file for a maven project that depends on luaj.
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
String script = "print 'hello, from luaj!'";
|
||||
|
||||
// create an environment to run in
|
||||
Globals globals = JsePlatform.standardGlobals();
|
||||
|
||||
// Use the convenience function on the globals to load a chunk.
|
||||
LuaValue chunk = globals.loadString(script, "maven-exmaple");
|
||||
|
||||
// Use any of the "call()" or "invoke()" functions directly on the chunk.
|
||||
chunk.call();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user