当前位置: 首页>>代码示例>>Java>>正文


Java LuaConversion.convertToLua方法代码示例

本文整理汇总了Java中ethanjones.cubes.core.lua.convert.LuaConversion.convertToLua方法的典型用法代码示例。如果您正苦于以下问题:Java LuaConversion.convertToLua方法的具体用法?Java LuaConversion.convertToLua怎么用?Java LuaConversion.convertToLua使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ethanjones.cubes.core.lua.convert.LuaConversion的用法示例。


在下文中一共展示了LuaConversion.convertToLua方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invokeFor

import ethanjones.cubes.core.lua.convert.LuaConversion; //导入方法依赖的package包/类
private void invokeFor(Class[] parameters, Object[] param, Varargs args, Method method) {
	try {
		for (int i = 0; i < parameters.length; i++) {

			param[i] = LuaConversion.convertToJava(parameters[i], args.arg(i + 1));
		}
	} catch (Exception ignored) {
		continue;
	}
	try {
		Object invoke = method.invoke(null, param);
		return LuaConversion.convertToLua(invoke);
	} catch (Exception e) {
		throw new LuaError(e);
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:LuaMethod.java

示例2: convertParamsToLua

import ethanjones.cubes.core.lua.convert.LuaConversion; //导入方法依赖的package包/类
public static LuaValue[] convertParamsToLua(Object instance, Object[] objects, final Callable supercall) {
	LuaValue[] parameters = new LuaValue[objects.length + 2];
	parameters[0] = LuaConversion.convertToLua(instance);
	for (int i = 0; i < objects.length; i++) {
		parameters[i + 1] = LuaConversion.convertToLua(objects[i]);
	}
	parameters[parameters.length - 1] = new VarArgFunction() {
		@Override
		public Varargs invoke(Varargs args) {
			try {
				Object o = supercall.call();
				return LuaConversion.convertToLua(o);
			} catch (Exception e) {
				throw new DynamicDelegationError("Supercall threw exception - called from supplied delegation", e);
			}
		}
	};
	return parameters;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:20,代码来源:LuaGeneration.java

示例3: convertParamsToLua

import ethanjones.cubes.core.lua.convert.LuaConversion; //导入方法依赖的package包/类
public static LuaValue[] convertParamsToLua(Object instance, Object[] objects, final Callable supercall) {
  LuaValue[] parameters = new LuaValue[objects.length + 2];
  parameters[0] = LuaConversion.convertToLua(instance);
  for (int i = 0; i < objects.length; i++) {
    parameters[i + 1] = LuaConversion.convertToLua(objects[i]);
  }
  parameters[parameters.length - 1] = new VarArgFunction() {
    @Override
    public Varargs invoke(Varargs args) {
      try {
        Object o = supercall.call();
        return LuaConversion.convertToLua(o);
      } catch (Exception e) {
        throw new DynamicDelegationError("Supercall threw exception - called from supplied delegation", e);
      }
    }
  };
  return parameters;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:20,代码来源:LuaGeneration.java

示例4: GlobalIf2

import ethanjones.cubes.core.lua.convert.LuaConversion; //导入方法依赖的package包/类
private LuaConversion GlobalIf2(LiaValue args) {
	if (args.narg() <= 1 || (args.narg() == 2 && args.arg1().isnil()))
		throw new LuaError("Invalid extend arguments: " + args.toString());
	LuaTable delegations = args.arg(args.narg()).checktable();
	Class extend = args.arg1().isnil() ? Object.class : convertToClass(args.arg1());
	Class[] inherit = new Class[args.narg() - 2];
	for (int i = 0; i < inherit.length; i++) {
		inherit[i] = convertToClass(args.arg(i + 2));
	}
	Class c = LuaGeneration.extendClass(extend, delegations, inherit);
	return LuaConversion.convertToLua(c);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:13,代码来源:CubesLua.java


注:本文中的ethanjones.cubes.core.lua.convert.LuaConversion.convertToLua方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。