forked from farmboy0/luaj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSampleMIDlet.java
More file actions
32 lines (21 loc) · 794 Bytes
/
SampleMIDlet.java
File metadata and controls
32 lines (21 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import org.luaj.vm2.*;
import org.luaj.vm2.lib.jme.JmePlatform;
public class SampleMIDlet extends MIDlet {
// the script will be loaded as a resource
private static final String DEFAULT_SCRIPT = "hello.lua";
protected void startApp() throws MIDletStateChangeException {
// get the script as an app property
String script = this.getAppProperty("script");
if ( script == null )
script = DEFAULT_SCRIPT;
// create an environment to run in
Globals globals = JmePlatform.standardGlobals();
globals.get("require").call( LuaValue.valueOf(script) );
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
protected void pauseApp() {
}
}