本文整理汇总了Java中org.luaj.vm2.Varargs.optfunction方法的典型用法代码示例。如果您正苦于以下问题:Java Varargs.optfunction方法的具体用法?Java Varargs.optfunction怎么用?Java Varargs.optfunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.luaj.vm2.Varargs
的用法示例。
在下文中一共展示了Varargs.optfunction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public Varargs invoke(Varargs args) {
int a = 1;
LuaThread t = args.isthread(a) ? args.checkthread(a++) : globals.running;
LuaValue func = args.optfunction(a++, null);
String str = args.optjstring(a++, "");
int count = args.optint(a++, 0);
boolean call = false, line = false, rtrn = false;
for (int i = 0; i < str.length(); i++)
switch (str.charAt(i)) {
case 'c':
call = true;
break;
case 'l':
line = true;
break;
case 'r':
rtrn = true;
break;
}
t.hookfunc = func;
t.hookcall = call;
t.hookline = line;
t.hookcount = count;
t.hookrtrn = rtrn;
return NONE;
}
示例2: invoke
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public Varargs invoke(Varargs args) {
int a=1;
LuaThread t = args.isthread(a)? args.checkthread(a++): globals.running;
LuaValue func = args.optfunction(a++, null);
String str = args.optjstring(a++,"");
int count = args.optint(a++,0);
boolean call=false,line=false,rtrn=false;
for ( int i=0; i<str.length(); i++ )
switch ( str.charAt(i) ) {
case 'c': call=true; break;
case 'l': line=true; break;
case 'r': rtrn=true; break;
}
LuaThread.State s = t.state;
s.hookfunc = func;
s.hookcall = call;
s.hookline = line;
s.hookcount = count;
s.hookrtrn = rtrn;
return NONE;
}
示例3: invoke
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
@Override
public Varargs invoke(Varargs args) {
final String url = args.optjstring(1, null);
if (!TextUtils.isEmpty(url)) {
final String fileName = args.optjstring(2, newFileName(url));
final LuaFunction callback = args.optfunction(3, null);
//TODO 下载器下载并保存
}
return UDDownloader.this;
}
示例4: setImage
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setImage(U view, Varargs varargs) {
if (varargs.isstring(2)) {
final String url = varargs.optjstring(2, null);
final LuaFunction callback = varargs.optfunction(3, null);
return view.setImageUrl(url, callback);
} else if (varargs.arg(2) instanceof UDData) {//data
final UDData data = (UDData) varargs.arg(2);
return view.setImageBytes(data != null ? data.bytes() : null);
} else if (varargs.arg(2) instanceof UDBitmap){//bitmap
final UDBitmap bitmap = (UDBitmap) varargs.arg(2);
return view.setImageBitmap(bitmap);
}
return view;
}
示例5: setCallback
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setCallback(U udTimer, Varargs varargs) {
final LuaFunction callback = varargs.optfunction(2, null);
return udTimer.setCallback(callback);
}
示例6: onStartCallback
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue onStartCallback(U udAnimation, Varargs varargs) {
final LuaFunction callback = varargs.optfunction(2, null);
return udAnimation.setOnStartCallback(callback);
}
示例7: onEndCallback
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue onEndCallback(U udAnimation, Varargs varargs) {
final LuaFunction callback = varargs.optfunction(2, null);
return udAnimation.setOnEndCallback(callback);
}
示例8: onRepeatCallback
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue onRepeatCallback(U udAnimation, Varargs varargs) {
final LuaFunction callback = varargs.optfunction(2, null);
return udAnimation.setOnRepeatCallback(callback);
}
示例9: setCallback
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setCallback(U http, Varargs varargs) {
final LuaFunction callback = varargs.optfunction(2, null);
return http.setCallback(callback);
}