Console output missing when running LuaJava Hello, World program
I am starting to learn Lua script usage in Java via LuaJava; my IDE is Eclipse.
But when I execute this simple Hello World snippet, there is no output in the Eclipse console.
Took a code snippet from here
package com.cpg.lua;
import org.keplerproject.luajava.LuaState;
import org.keplerproject.luajava.LuaStateFactory;
public class Hello
{
public static void main(String[] args)
{
LuaState luaState;
luaState = LuaStateFactory.newLuaState();
luaState.openLibs();
luaState.LdoFile("hello.lua");
luaState.close();
}
}
hello.lua
function hello()
print("Hello World from Lua!")
end
hello()
But the script below works fine.
hello2.lua
print("Hello World from Lua!")
Does anyone know why a script with a function definition inside does nothing when called from Java, but works fine when executed through the console?
+3
source to share