Created
May 20, 2014 01:18
-
-
Save wendal/87a2d821e7600f3e5494 to your computer and use it in GitHub Desktop.
luajava调用java对象方法及接收返回值
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LuaState lua = LuaStateFactory.newLuaState(); | |
lua.openLibs(); | |
lua.pushJavaObject(new Thread() { | |
public void run() { | |
System.out.println("Lua Thread?"); | |
} | |
}); | |
lua.setGlobal("t"); | |
int re = lua.LloadString("function f() t:run() return 123 end return f()"); | |
System.out.println(re); | |
lua.pcall(0, 1, 0); | |
System.out.println("re="+re); | |
System.out.println(lua.getTop()); | |
System.out.println(lua.getLuaObject(1).getNumber()); | |
Lang.quiteSleep(2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment