本文整理汇总了Java中org.keplerproject.luajava.LuaState类的典型用法代码示例。如果您正苦于以下问题:Java LuaState类的具体用法?Java LuaState怎么用?Java LuaState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LuaState类属于org.keplerproject.luajava包,在下文中一共展示了LuaState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initLuaContext
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
private void initLuaContext(LuaState luaState){
try {
JavaFunction logfunction = new LogFunctionCallBack(luaState);
logfunction.register("log");
JavaFunction tostringfunction = new ToStringFunctionCallBack(luaState);
tostringfunction.register("tostring");
JavaFunction bindfunction = new BindClassCallBack(luaState);
bindfunction.register("bind");
JavaFunction reflecttion = new ReflectCallBack(luaState);
reflecttion.register("getMethod");
} catch (LuaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:CvvT,项目名称:AppTroy,代码行数:17,代码来源:LuaScriptInvoker.java
示例2: initLuaContext
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
private void initLuaContext(LuaState luaState){
try {
JavaFunction logfunction = new LogFunctionCallBack(luaState);
logfunction.register("log");
JavaFunction tostringfunction = new ToStringFunctionCallBack(luaState);
tostringfunction.register("tostring");
luaState.pushJavaObject(ModuleContext.getInstance().getAppContext().getApplicationContext());
luaState.setGlobal("context");
luaState.pushJavaObject(ZjDroidLuaJavaAPI.getInstance());
luaState.setGlobal("zjdroid");
} catch (LuaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:mikusjelly,项目名称:HeyGirl,代码行数:17,代码来源:LuaScriptInvoker.java
示例3: stackDump
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
static void stackDump (LuaState L) {
int i;
int top = L.getTop();
for (i = 1; i<=top; i++) {
int t = L.type(i);
if (t == LuaState.LUA_TSTRING) {
Log.v("String", L.toString(i));
} else if (t == LuaState.LUA_TBOOLEAN) {
Log.v("Boolean", String.valueOf(L.toBoolean(i)));
} else if (t == LuaState.LUA_TNUMBER) {
Log.v("Number", String.valueOf(L.toNumber(i)));
} else if (t == LuaState.LUA_TNIL) {
Log.v("Nil", "nil");
} else {
Log.v("Other", String.valueOf(L.typeName(i)));
}
}
}
开发者ID:thalesfp,项目名称:LuaAndroidExample,代码行数:21,代码来源:MainActivity.java
示例4: sandbox
import org.keplerproject.luajava.LuaState; //导入依赖的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
示例5: 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());
}
开发者ID:amdiaosi,项目名称:nutzWx,代码行数:19,代码来源:WxManagerModule.java
示例6: initLuaContext
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
private void initLuaContext(LuaState luaState){
try {
JavaFunction logfunction = new LogFunctionCallBack(luaState);
logfunction.register("log");
JavaFunction tostringfunction = new ToStringFunctionCallBack(luaState);
tostringfunction.register("tostring");
} catch (LuaException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:Miracle963,项目名称:zjdroid,代码行数:13,代码来源:LuaScriptInvoker.java
示例7: 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();
}
开发者ID:Miracle963,项目名称:zjdroid,代码行数:13,代码来源:LuaScriptInvoker.java
示例8: 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();
}
开发者ID:Miracle963,项目名称:zjdroid,代码行数:12,代码来源:LuaScriptInvoker.java
示例9: 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();
}
开发者ID:CvvT,项目名称:AppTroy,代码行数:13,代码来源:LuaScriptInvoker.java
示例10: 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();
}
开发者ID:CvvT,项目名称:AppTroy,代码行数:12,代码来源:LuaScriptInvoker.java
示例11: onSuccess
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void onSuccess(int l, Header aheader[], byte abyte0[])
{
String s = Utils.getStringFromBytes(abyte0);
j j1;
j1 = (j)Utils.getGson().fromJson(s, cn/com/smartdevices/bracelet/lua/j);
if (j1.a != 1)
{
Debug.i("chenee", (new StringBuilder()).append("get latest luaZipFile error (message:").append(j1.b).append(")").toString());
return;
}
try
{
byte abyte1[] = Base64.decode(j1.c.b, 2);
LuaZipFile luazipfile = new LuaZipFile();
luazipfile.setVersion(j1.c.c);
luazipfile.setZipFile(abyte1);
LuaZipFileDao luazipfiledao = DaoManager.getInstance().getLuaZipFileDao();
luazipfiledao.insertOrReplace(luazipfile);
Keeper.keepLatestDBLuaVersion(j1.c.c);
Debug.i("chenee", (new StringBuilder()).append("save DB luaZipFile onSuccess====(version:").append(j1.c.c).append(")").toString());
a.resetLuaState();
LuaState luastate = a.getLuaState();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "setLocale");
luastate.pushString(Locale.getDefault().toString());
a.callLua(1, 0);
Debug.i("chenee", (new StringBuilder()).append("zipfile count:").append(luazipfiledao.count()).toString());
return;
}
catch (Exception exception)
{
Debug.e("chenee", (new StringBuilder()).append("get latest lua gson error!:").append(exception.getMessage()).toString());
}
return;
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:35,代码来源:i.java
示例12: doLuaAction
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void doLuaAction(String s)
{
Debug.i("chenee", (new StringBuilder()).append("-------------\n").append(s).toString());
Debug.i("chenee", "--------------------\n");
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = LuaManager.getInstance().getLuaState();
luastate.LdoString(s);
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "doAction");
luastate.pushJavaObject(context);
luastate.pushJavaObject(__instance);
luamanager.callLua(2, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:13,代码来源:LuaAction.java
示例13: callLuaFunc
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void callLuaFunc(String s, EventGameUpdate eventgameupdate)
{
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), s);
eventgameupdate.getConfigInfo().setLuaAction(context);
luastate.pushJavaObject(DaoManager.getInstance().getLuaListDao());
luastate.pushJavaObject(eventgameupdate.getConfigInfo());
luamanager.callLua(2, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:11,代码来源:LuaEvent.java
示例14: getGameInfo
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public String getGameInfo()
{
setLocale(Locale.getDefault().toString());
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "getGameInfo");
luastate.pushJavaObject(cInfo);
luamanager.callLua(1, 0);
Debug.i("LuaEvent", (new StringBuilder()).append("get lua game info =").append(cInfo.getGameInfo()).toString());
return cInfo.getGameInfo();
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:12,代码来源:LuaEvent.java
示例15: getLuaVersion
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public String getLuaVersion()
{
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "getLuaVersion");
luastate.pushJavaObject(cInfo);
luamanager.callLua(1, 0);
String s = cInfo.getLuaVersion();
Debug.i("LuaEvent", (new StringBuilder()).append("get lua version from local =").append(cInfo.getLuaVersion()).toString());
return s;
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:12,代码来源:LuaEvent.java
示例16: setGoal
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void setGoal()
{
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
de.greenrobot.daobracelet.LuaListDao lualistdao = DaoManager.getInstance().getLuaListDao();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "dayComplete");
luastate.pushJavaObject(lualistdao);
luastate.pushJavaObject(cInfo);
luamanager.callLua(2, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:11,代码来源:LuaEvent.java
示例17: setLocale
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void setLocale(String s)
{
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "setLocale");
luastate.pushString(s);
luamanager.callLua(1, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:9,代码来源:LuaEvent.java
示例18: setRecord
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void setRecord(ReportData reportdata)
{
cInfo.setNewRecordReport(reportdata);
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
de.greenrobot.daobracelet.LuaListDao lualistdao = DaoManager.getInstance().getLuaListDao();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "newRecord");
luastate.pushJavaObject(lualistdao);
luastate.pushJavaObject(cInfo);
luamanager.callLua(2, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:12,代码来源:LuaEvent.java
示例19: testAction
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void testAction()
{
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
LuaAction luaaction = LuaAction.getInstance(context);
de.greenrobot.daobracelet.LuaListDao lualistdao = DaoManager.getInstance().getLuaListDao();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "doAction2");
luastate.pushJavaObject(context);
luastate.pushJavaObject(luaaction);
luastate.pushJavaObject(lualistdao);
luamanager.callLua(3, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:13,代码来源:LuaEvent.java
示例20: luaEventAchievementMsg
import org.keplerproject.luajava.LuaState; //导入依赖的package包/类
public void luaEventAchievementMsg(ConfigDynamicDataInfo configdynamicdatainfo)
{
LuaManager luamanager = LuaManager.getInstance();
LuaState luastate = luamanager.getLuaState();
luastate.getField(LuaState.LUA_GLOBALSINDEX.intValue(), "getAchievementMsgs");
luastate.pushJavaObject(listDao);
luastate.pushJavaObject(configdynamicdatainfo);
luamanager.callLua(2, 0);
}
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:10,代码来源:LuaEventMsgs.java
注:本文中的org.keplerproject.luajava.LuaState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论