org.keplerproject.luajava.LuaException Java Examples

The following examples show how to use org.keplerproject.luajava.LuaException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuaScriptInvoker.java    From AppTroy with Apache License 2.0 6 votes vote down vote up
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();
    }

}
 
Example #2
Source File: LuaScriptInvoker.java    From AppTroy with Apache License 2.0 6 votes vote down vote up
@Override
public int execute() throws LuaException {
    int param_size = this.L.getTop();
    if (param_size == 2) {
        String clsName = this.L.getLuaObject(2).getString();
        try {
            Class<?> clazz = ModuleContext.getInstance().getBaseClassLoader().loadClass(clsName);
            this.L.pushJavaObject(clazz);
            return 1;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return 0;
        }
    }
    return 0;
}
 
Example #3
Source File: LuaScriptInvoker.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
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();
	}
	
}
 
Example #4
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
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) {
		e.printStackTrace();
	}
	
}
 
Example #5
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	for(int i=2; i<=param_size; i++){
		try {
			String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
			Logger.log(objDsrc);
		} catch (Exception e) {
			e.printStackTrace();
		}				
	}
	return 0;
}
 
Example #6
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	if(param_size ==2 ){
		String message = this.L.getLuaObject(2).getString();
		Logger.log(message);
	}
	
	return 0;
}
 
Example #7
Source File: LuaScriptInvoker.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
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();
	}
	
}
 
Example #8
Source File: LuaScriptInvoker.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	for(int i=2; i<=param_size; i++){
		try {
			String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
			Logger.log(objDsrc);
		} catch (Exception e) {
			e.printStackTrace();
		}				
	}
	return 0;
}
 
Example #9
Source File: LuaScriptInvoker.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	if(param_size ==2 ){
		String message = this.L.getLuaObject(2).getString();
		Logger.log(message);
	}
	
	return 0;
}
 
Example #10
Source File: LuaScriptInvoker.java    From AppTroy with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {

    int param_size = this.L.getTop();
    for(int i=2; i<=param_size; i++){
        try {
            String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
            Logger.log(objDsrc);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return 0;
}
 
Example #11
Source File: LuaScriptInvoker.java    From AppTroy with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {

    int param_size = this.L.getTop();
    if(param_size ==2 ){
        String message = this.L.getLuaObject(2).getString();
        Logger.log(message);
    }

    return 0;
}
 
Example #12
Source File: LuaScriptInvoker.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	for(int i=2; i<=param_size; i++){
		try {
			String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
			Logger.log(objDsrc);
		} catch (Exception e) {
			e.printStackTrace();
		}				
	}
	return 0;
}
 
Example #13
Source File: LuaScriptInvoker.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	if(param_size ==2 ){
		String message = this.L.getLuaObject(2).getString();
		Logger.log(message);
	}
	
	return 0;
}
 
Example #14
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
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();
	}
	
}
 
Example #15
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	for(int i=2; i<=param_size; i++){
		try {
			String objDsrc = JsonWriter.parserInstanceToJson(this.getParam(i).getObject());
			Logger.log(objDsrc);
		} catch (Exception e) {
			e.printStackTrace();
		}				
	}
	return 0;
}
 
Example #16
Source File: LuaScriptInvoker.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int execute() throws LuaException {
	
	int param_size = this.L.getTop();
	if(param_size ==2 ){
		String message = this.L.getLuaObject(2).getString();
		Logger.log(message);
	}
	
	return 0;
}