本文整理汇总了Java中org.luaj.vm2.Varargs.optjstring方法的典型用法代码示例。如果您正苦于以下问题:Java Varargs.optjstring方法的具体用法?Java Varargs.optjstring怎么用?Java Varargs.optjstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.luaj.vm2.Varargs
的用法示例。
在下文中一共展示了Varargs.optjstring方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
public Varargs invoke(Varargs args) {
LuaValue ld = args.arg1();
args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function");
String source = args.optjstring(2, ld.isstring() ? ld.tojstring() : "=(load)");
String mode = args.optjstring(3, "bt");
LuaValue env = args.optvalue(4, globals);
return loadStream(ld.isstring() ? ld.strvalue().toInputStream() :
new StringInputStream(ld.checkfunction()), source, mode, env);
}
示例4: invoke
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
@Override
public Varargs invoke(Varargs args) {
if (args.narg() >= 2) {
final String typeface = args.optjstring(2, null);
if (!TextUtils.isEmpty(typeface)) {
getDefaultPaint(null).setTypeface(getLuaResourceFinder().findTypeface(typeface));
}
}
return UDCanvas.this;
}
示例5: invoke
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public Varargs invoke(Varargs args) {
LuaValue ld = args.arg1();
args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function");
String source = args.optjstring(2, ld.isstring() ? ld.tojstring() : "=(load)");
String mode = args.optjstring(3, "bt");
LuaValue env = args.optvalue(4, globals);
return loadStream(ld.isstring() ? ld.strvalue().toInputStream() : new
StringInputStream(ld.checkfunction()), source, mode, env);
}
示例6: invoke
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public Varargs invoke(Varargs args) {
String name = args.checkjstring(1);
String path = args.checkjstring(2);
String sep = args.optjstring(3, ".");
String rep = args.optjstring(4, FILE_SEP);
// check the path elements
int e = -1;
int n = path.length();
StringBuffer sb = null;
name = name.replace(sep.charAt(0), rep.charAt(0));
while ( e < n ) {
// find next template
int b = e+1;
e = path.indexOf(';',b);
if ( e < 0 )
e = path.length();
String template = path.substring(b,e);
// create filename
int q = template.indexOf('?');
String filename = template;
if ( q >= 0 ) {
filename = template.substring(0,q) + name + template.substring(q+1);
}
// try opening the file
InputStream is = globals.finder.findResource(filename);
if (is != null) {
try { is.close(); } catch ( java.io.IOException ioe ) {}
return valueOf(filename);
}
// report error
if ( sb == null )
sb = new StringBuffer();
sb.append( "\n\t"+filename );
}
return varargsOf(NIL, valueOf(sb.toString()));
}
示例7: setScaleType
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setScaleType(U view, Varargs varargs) {
final String scaleTypeName = varargs.optjstring(2, ImageView.ScaleType.FIT_XY.name());//默认FIT_XY
final ImageView.ScaleType scaleType = UDImageScaleType.parse(scaleTypeName);
return view.setScaleType(scaleType);
}
示例8: setImage
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setImage(U view, Varargs varargs) {//TODO 支持参数为Data类型
final String normalImage = varargs.optjstring(2, null);
final String pressedImage = varargs.optjstring(3, null);
return view.setImage(normalImage, pressedImage);
}
示例9: setFontName
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setFontName(U view, Varargs varargs) {
final String fontName = varargs.optjstring(2, null);
return view.setFont(fontName);
}
示例10: setUrl
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setUrl(U http, Varargs varargs) {
final String url = varargs.optjstring(2, null);
return http.setUrl(url);
}
示例11: setMethod
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
public LuaValue setMethod(U http, Varargs varargs) {
final String method = varargs.optjstring(2, UDHttp.METHOD_POST);
return http.setMethod(method);
}
示例12: toTable
import org.luaj.vm2.Varargs; //导入方法依赖的package包/类
/**
* 将二进制数据转成table,使用给定的编码,默认utf-8
*
* @param data
* @param varargs
* @return
*/
public LuaValue toTable(U data, Varargs varargs) {
final String encode = varargs.optjstring(2, UDData.DEFAULT_ENCODE);
return data.toTable(encode);
}