本文整理匯總了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);
}
}
示例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;
}
示例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;
}
示例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);
}