本文整理汇总了Java中org.luaj.vm2.Varargs.checkint方法的典型用法代码示例。如果您正苦于以下问题:Java Varargs.checkint方法的具体用法?Java Varargs.checkint怎么用?Java Varargs.checkint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.luaj.vm2.Varargs
的用法示例。
在下文中一共展示了Varargs.checkint方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
LuaString name = findupvalue(c, up);
if (name != null) {
return varargsOf(name, c.upValues[up - 1].getValue());
}
}
return NIL;
}
示例3: bxor
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
static Varargs bxor( Varargs args ) {
int result = 0;
for ( int i = 1; i <= args.narg(); i++ ) {
result ^= args.checkint(i);
}
return bitsToValue( result );
}
示例4: band
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
static Varargs band( Varargs args ) {
int result = -1;
for ( int i = 1; i <= args.narg(); i++ ) {
result &= args.checkint(i);
}
return bitsToValue( result );
}
示例5: btest
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
static Varargs btest( Varargs args ) {
int bits = -1;
for ( int i = 1; i <= args.narg(); i++ ) {
bits &= args.checkint(i);
}
return valueOf( bits != 0 );
}
示例6: bor
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
static Varargs bor( Varargs args ) {
int result = 0;
for ( int i = 1; i <= args.narg(); i++ ) {
result |= args.checkint(i);
}
return bitsToValue( result );
}
示例7: 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;
LuaString name = findupvalue(c, up);
if ( name != null ) {
return varargsOf(name, c.upValues[up-1].getValue() );
}
}
return NIL;
}
示例8: 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 );
}
示例9: char_
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
/**
* string.char (...)
*
* Receives zero or more integers. Returns a string with length equal
* to the number of arguments, in which each character has the internal
* numerical code equal to its corresponding argument.
*
* Note that numerical codes are not necessarily portable across platforms.
*
* @param args the calling VM
*/
public static Varargs char_(Varargs args) {
int n = args.narg();
byte[] bytes = new byte[n];
for (int i = 0, a = 1; i < n; i++, a++) {
int c = args.checkint(a);
if (c < 0 || c >= 256) argerror(a, "invalid value");
bytes[i] = (byte) c;
}
return LuaString.valueOf(bytes);
}