I hate to say it while the API works they tend not to respond to the forum :( If you want to ask I suggest an email to Ian Farmer direct from the contact list. It's not quick replies, but he does get back to you.
1. Luaj I believe does allow for String execution in a Closure(running enviroment). If there isn't a direct way there is still away. So I would say yes.
public static void main(String[] args) {
String script = (args.length>0? args[0]: "src/test/res/swingapp.lua"); // loads file as a string
Platform.setInstance( new J2sePlatform() );
LuaState vm = Platform.newLuaState();
org.luaj.compiler.LuaC.install();
vm.getglobal( "dofile" );
vm.pushstring( script );
vm.call( 1, 0 ); // executed
}
}
As you can see with the above code when the lua code is executed. It's just a string value.
2. Luaj should run on any device that supports J2ME. I know almost all cellphones run a version of J2ME, so I would assume Smartphones do to. On a quick search it looks like Black Berry also has a Java enviroment. So that should be good to go too.
There are sample codes. In the code above, just use the "new J2mePlatform()" and vm.push/call you string.
You may want to experiment a bit.
If you don't mind compiling your lua code(something I don't understand if your using a script language) then you might want to try Kahlua. It is smaller.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have two questions...
1. Does Luaj have a mode to execute commands immediately when they are typed in?
2. Is is possible to install Luaj as a application on a BlackBerry or other smartphone?
I hate to say it while the API works they tend not to respond to the forum :( If you want to ask I suggest an email to Ian Farmer direct from the contact list. It's not quick replies, but he does get back to you.
1. Luaj I believe does allow for String execution in a Closure(running enviroment). If there isn't a direct way there is still away. So I would say yes.
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"); // loads file as a string
Platform.setInstance( new J2sePlatform() );
LuaState vm = Platform.newLuaState();
org.luaj.compiler.LuaC.install();
vm.getglobal( "dofile" );
vm.pushstring( script );
vm.call( 1, 0 ); // executed
}
}
As you can see with the above code when the lua code is executed. It's just a string value.
2. Luaj should run on any device that supports J2ME. I know almost all cellphones run a version of J2ME, so I would assume Smartphones do to. On a quick search it looks like Black Berry also has a Java enviroment. So that should be good to go too.
There are sample codes. In the code above, just use the "new J2mePlatform()" and vm.push/call you string.
You may want to experiment a bit.
If you don't mind compiling your lua code(something I don't understand if your using a script language) then you might want to try Kahlua. It is smaller.