本文整理汇总了Java中org.keplerproject.luajava.LuaState.openLibs方法的典型用法代码示例。如果您正苦于以下问题:Java LuaState.openLibs方法的具体用法?Java LuaState.openLibs怎么用?Java LuaState.openLibs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.keplerproject.luajava.LuaState
的用法示例。
在下文中一共展示了LuaState.openLibs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.keplerproject.luajava.LuaState; //导入方法依赖的package包/类
public static void main(String[] args) throws LuaException {
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);
// System.out.println(System.currentTimeMillis());
}
示例2: invokeScript
import org.keplerproject.luajava.LuaState; //导入方法依赖的package包/类
public void invokeScript(String script){
LuaState luaState = LuaStateFactory.newLuaState();
luaState.openLibs();
this.initLuaContext(luaState);
int error = luaState.LdoString(script);
if(error!=0){
Logger.log("Read/Parse lua error. Exit");
return;
}
luaState.close();
}
示例3: invokeFileScript
import org.keplerproject.luajava.LuaState; //导入方法依赖的package包/类
public void invokeFileScript(String scriptFilePath){
LuaState luaState = LuaStateFactory.newLuaState();
luaState.openLibs();
this.initLuaContext(luaState);
int error = luaState.LdoFile(scriptFilePath);
if(error!=0){
Logger.log("Read/Parse lua error. Exit");
return;
}
luaState.close();
}
示例4: invokeScript
import org.keplerproject.luajava.LuaState; //导入方法依赖的package包/类
public void invokeScript(String script){
LuaState luaState = LuaStateFactory.newLuaState();
luaState.openLibs();
this.initLuaContext(luaState);
int error = luaState.LdoString(script);
if(error!=0){
Logger.log("Read/Parse lua error. Exit");
return;
}
luaState.close();
}
示例5: invokeFileScript
import org.keplerproject.luajava.LuaState; //导入方法依赖的package包/类
public void invokeFileScript(String scriptFilePath){
LuaState luaState = LuaStateFactory.newLuaState();
luaState.openLibs();
this.initLuaContext(luaState);
int error = luaState.LdoFile(scriptFilePath);
if(error!=0){
Logger.log("Read/Parse lua error. Exit");
return;
}
luaState.close();
}
示例6: main
import org.keplerproject.luajava.LuaState; //导入方法依赖的package包/类
public static void main(String[] args) {
System.out.println(System.getProperty("java.library.path"));
LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
L.LdoFile("hello.lua");
}