本文整理汇总了Java中org.luaj.vm2.Varargs类的典型用法代码示例。如果您正苦于以下问题:Java Varargs类的具体用法?Java Varargs怎么用?Java Varargs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Varargs类属于org.luaj.vm2包,在下文中一共展示了Varargs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public Varargs invoke(int code, U target, Varargs varargs) {
final int optcode = code - super.getAllFunctionNames().size();
switch (optcode) {
case 0:
return delay(target, varargs);
case 1:
return repeat(target, varargs);
case 2:
return repeatCount(target, varargs);
case 3:
return interval(target, varargs);
case 4:
return start(target, varargs);
case 5:
return callback(target, varargs);
case 6:
return cancel(target, varargs);
}
return super.invoke(code, target, varargs);
}
示例2: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
LuaString s = args.checkstring(1);
int l = s.m_length;
int posi = posrelat( args.optint(2,1), l );
int pose = posrelat( args.optint(3,posi), l );
int n,i;
if (posi <= 0) posi = 1;
if (pose > l) pose = l;
if (posi > pose) return NONE; /* empty interval; return no values */
n = (int)(pose - posi + 1);
if (posi + n <= pose) /* overflow? */
error("string slice too long");
LuaValue[] v = new LuaValue[n];
for (i=0; i<n; i++)
v[i] = valueOf(s.luaByte(posi+i-1));
return varargsOf(v);
}
示例3: invokeBestMethod
import org.luaj.vm2.Varargs; //导入依赖的package包/类
private LuaValue invokeBestMethod(Object instance, Varargs args) {
JavaMethod best = null;
int score = CoerceLuaToJava.SCORE_UNCOERCIBLE;
for ( int i=0; i<methods.length; i++ ) {
int s = methods[i].score(args);
if ( s < score ) {
score = s;
best = methods[i];
if ( score == 0 )
break;
}
}
// any match?
if ( best == null )
LuaValue.error("no coercible public method");
// invoke it
return best.invokeMethod(instance, args);
}
示例4: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public Varargs invoke(Varargs args) {
if (args.narg() > 1) {
return new UDNavigation.setLeft().invoke(args);
} else {
return new UDNavigation.getLeft().invoke(args);
}
}
示例5: getAlphaInt
import org.luaj.vm2.Varargs; //导入依赖的package包/类
public static Integer getAlphaInt(final Varargs varargs, Double defaultAlpha, int... poslist) {
final Double alphaDouble = getDouble(varargs, poslist);
if (alphaDouble != null) {
return (int) (alphaDouble * 0xFF);
} else if (defaultAlpha != null) {
return (int) (defaultAlpha * 0xFF);
} else {
return null;
}
}
示例6: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public Varargs invoke(int code, U target, Varargs varargs) {
final int optcode = code - super.getAllFunctionNames().size();
switch (optcode) {
case 0:
return onDraw(target, varargs);
}
return super.invoke(code, target, varargs);
}
示例7: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
LuaValue func = args.checkfunction(1);
int up = args.checkint(2);
LuaValue value = args.arg(3);
if (func instanceof LuaClosure) {
LuaClosure c = (LuaClosure) func;
LuaString name = findupvalue(c, up);
if (name != null) {
c.upValues[up - 1].setValue(value);
return name;
}
}
return NIL;
}
示例8: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
LuaTable t = args.checktable(1);
switch (args.narg()) {
case 1: return t.unpack();
case 2: return t.unpack(args.checkint(2));
default: return t.unpack(args.checkint(2), args.checkint(3));
}
}
示例9: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
LuaValue func = args.checkfunction(1);
int up = args.checkint(2);
if ( func instanceof LuaClosure ) {
LuaClosure c = (LuaClosure) func;
if ( c.upValues != null && up > 0 && up <= c.upValues.length ) {
return valueOf(c.upValues[up-1].hashCode());
}
}
return NIL;
}
示例10: onCalled
import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public LuaValue onCalled(Varargs parameters) {
String name = parameters.arg(1).tojstring();
String version = parameters.arg(2).tojstring();
String desc = parameters.arg(3).tojstring();
LuaValue function = parameters.arg(4);
LuaPlugin plugin = new LuaPlugin(name, version, desc, function);
Environment.PLUGINS.add(plugin);
return LuaValue.NIL;
}
示例11: instr
import org.luaj.vm2.Varargs; //导入依赖的package包/类
void instr(int pc, Varargs v, int top) {
this.pc = pc;
this.v = v;
this.top = top;
if (TRACE) {
new LuaPrint().buildState(f.checkclosure(), pc, stack, top, v).print();
//Print.printState(f.checkclosure(), pc, stack, top, v);
}
}
示例12: invoke
import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
LuaString s = args.checkstring( 1 );
int n = args.checkint( 2 );
final byte[] bytes = new byte[ s.length() * n ];
int len = s.length();
for ( int offset = 0; offset < bytes.length; offset += len ) {
s.copyInto( 0, bytes, offset, len );
}
return LuaString.valueUsing( bytes );
}
示例13: centerY
import org.luaj.vm2.Varargs; //导入依赖的package包/类
/**
* 设置中心Y位置
*
* @param view
* @param varargs
* @return
*/
public LuaValue centerY(U view, Varargs varargs) {
if (varargs.narg() > 1) {
return setCenterY(view, varargs);
} else {
return getCenterY(view, varargs);
}
}
示例14: contentOffset
import org.luaj.vm2.Varargs; //导入依赖的package包/类
/**
* 获取contentOffset大小
*
* @param view
* @param varargs
* @return
*/
@Deprecated
public LuaValue contentOffset(U view, Varargs varargs) {
if (varargs.narg() > 1) {
return setContentOffset(view, varargs);
} else {
return getContentOffset(view, varargs);
}
}
示例15: instr
import org.luaj.vm2.Varargs; //导入依赖的package包/类
void instr(int pc, Varargs v, int top) {
this.pc = pc;
this.v = v;
this.top = top;
if (TRACE)
Print.printState(f.checkclosure(), pc, stack, top, v);
}