本文整理汇总了Java中org.keplerproject.luajava.LuaStateFactory类的典型用法代码示例。如果您正苦于以下问题:Java LuaStateFactory类的具体用法?Java LuaStateFactory怎么用?Java LuaStateFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LuaStateFactory类属于org.keplerproject.luajava包,在下文中一共展示了LuaStateFactory类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: LuaImpl
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的package包/类
public LuaImpl(Intf... interfaces) {
try {
L = LuaStateFactory.newLuaState();
L.openLibs();
for (Intf f : interfaces) {
L.pushJavaObject(f.o);
L.setGlobal(f.name);
}
canScripts = true;
} catch (Exception t) {
e(t);
canScripts = false;
}
}
开发者ID:nmud,项目名称:nmud-demo,代码行数:17,代码来源:LuaImpl.java
示例2: LuaEnvironment
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的package包/类
public LuaEnvironment(Intf... interfaces) {
try {
L = LuaStateFactory.newLuaState();
L.openLibs();
for (Intf f : interfaces) {
L.pushJavaObject(f.o);
L.setGlobal(f.name);
}
canScripts = true;
} catch (Exception t) {
e(t);
canScripts = false;
}
}
开发者ID:nmud,项目名称:nmud-demo,代码行数:17,代码来源:LuaEnvironment.java
示例3: sandbox
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的package包/类
public LuaState sandbox(String openid) {
LuaState lua = LuaStateFactory.newLuaState();
lua.openBase();
lua.openDebug();
lua.openMath();
lua.openString();
lua.openTable();
// 移除loadfile方法
lua.pushNil();
lua.setGlobal("loadfile");
return lua;
}
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:18,代码来源:WxManagerModule.java
示例4: main
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的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());
}
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:19,代码来源:WxManagerModule.java
示例5: invokeScript
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的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();
}
开发者ID:Miracle963,项目名称:zjdroid,代码行数:13,代码来源:LuaScriptInvoker.java
示例6: invokeFileScript
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的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();
}
开发者ID:Miracle963,项目名称:zjdroid,代码行数:12,代码来源:LuaScriptInvoker.java
示例7: invokeScript
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的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();
}
开发者ID:CvvT,项目名称:AppTroy,代码行数:13,代码来源:LuaScriptInvoker.java
示例8: invokeFileScript
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的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();
}
开发者ID:CvvT,项目名称:AppTroy,代码行数:12,代码来源:LuaScriptInvoker.java
示例9: resetLuaState
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的package包/类
public void resetLuaState()
{
if (mLuaState != null)
{
mLuaState.close();
}
mLuaState = LuaStateFactory.newLuaState();
mLuaState.openLibs();
loadScriptFile();
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:11,代码来源:LuaManager.java
示例10: main
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的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");
}
开发者ID:cheyiliu,项目名称:test4XXX,代码行数:7,代码来源:TestMain.java
示例11: onCreate
import org.keplerproject.luajava.LuaStateFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btRun = (Button) findViewById(R.id.btRun);
Button btDownload = (Button) findViewById(R.id.btUpdate);
tvResult = (TextView) findViewById(R.id.tvResult);
L = LuaStateFactory.newLuaState();
L.openLibs();
btRun.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
L.LdoFile(Environment.getExternalStorageDirectory().getPath() + "/" + FILE);
L.getGlobal("name");
L.getGlobal("result");
L.pcall(0, 1, 0);
String name = L.toString(-2);
String result = L.toString(-1);
tvResult.setText(name + ": " + result);
stackDump(L);
L.setTop(0);
}
});
btDownload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tvResult.setText("");
DownloadTask downloadTask = new DownloadTask(MainActivity.this);
downloadTask.execute(URL + FILE);
}
});
}
开发者ID:thalesfp,项目名称:LuaAndroidExample,代码行数:44,代码来源:MainActivity.java
注:本文中的org.keplerproject.luajava.LuaStateFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论