lua - Java Game Scripting (LuaJava?) -
i'm writing 2d game in java , have reached point believe i'm better off keeping logic separate current game in form of scripts, plan reuse engine game after i'm done current game. i've found syntax , capabilities of lua inviting. however, i've had hell of time getting work. got luajava installed , library works in eclipse. when run hello.lua doesn't print console @ all. leaves no trace of running script, in fact. i'm discouraged i'd scripting , working on game more, i've had trouble. if no 1 sees familiar luajava, luaj, kahlua, etc. please refer me better/easier scripting language implement. know jython , rhino more popular, both seem complicated implement/use.
test.java
import org.keplerproject.luajava.luastate; import org.keplerproject.luajava.luastatefactory; public class test { public static void main(string[] args) { luastate lua = luastatefactory.newluastate(); lua.openlibs(); lua.ldofile("hello.lua"); lua.close(); } }
hello.lua
print("hello lua!")
how executing script? if executing script java program clicking on .jar file won't open console. must open cmd prompt , execute java program there using following cmd
java -jar jarfilename.jar
Comments
Post a Comment