本文整理匯總了Java中org.luaj.vm2.LuaValue.length方法的典型用法代碼示例。如果您正苦於以下問題:Java LuaValue.length方法的具體用法?Java LuaValue.length怎麽用?Java LuaValue.length使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.luaj.vm2.LuaValue
的用法示例。
在下文中一共展示了LuaValue.length方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawLines
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawLines(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
final float pts[] = new float[keys.length * 4];
LuaValue value = null;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 4) {
for (int j = 0; j < 4; j++) {
pts[i * 4 + j] = DimenUtil.dpiToPx(value.get(j + 1));
}
}
}
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
canvas.drawLines(pts, getDefaultPaint(config));
}
}
}
}
示例2: coerce
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public Object coerce(LuaValue value) {
switch ( value.type() ) {
case LuaValue.TTABLE: {
int n = value.length();
Object a = Array.newInstance(componentType, n);
for ( int i=0; i<n; i++ )
Array.set(a, i, componentCoercion.coerce(value.get(i+1)));
return a;
}
case LuaValue.TUSERDATA:
return value.touserdata();
case LuaValue.TNIL:
return null;
default:
return null;
}
}
示例3: clipRects
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void clipRects(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
float x1, y1, dx, dy;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 4) {
x1 = DimenUtil.dpiToPx(value.get(1));
y1 = DimenUtil.dpiToPx(value.get(2));
dx = DimenUtil.dpiToPx(value.get(3));
dy = DimenUtil.dpiToPx(value.get(4));
canvas.clipRect(x1, y1, x1 + dx, y1 + dy);
}
}
}
}
}
}
示例4: drawRects
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawRects(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
float x1, y1, dx, dy;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 4) {
x1 = DimenUtil.dpiToPx(value.get(1));
y1 = DimenUtil.dpiToPx(value.get(2));
dx = DimenUtil.dpiToPx(value.get(3));
dy = DimenUtil.dpiToPx(value.get(4));
canvas.drawRect(x1, y1, x1 + dx, y1 + dy, getDefaultPaint(LuaUtil.isTable(value.get(5)) ? value.get(5) : config));
}
}
}
}
}
}
示例5: drawPoints
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawPoints(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
final float pts[] = new float[keys.length * 2];
LuaValue value = null;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 2) {
for (int j = 0; j < 2; j++) {
pts[i * 2 + j] = DimenUtil.dpiToPx(value.get(j + 1));
}
}
}
canvas.drawPoints(pts, getDefaultPaint(config));
}
}
}
}
示例6: drawCircles
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawCircles(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 3) {
canvas.drawCircle(DimenUtil.dpiToPx(value.get(1)),
DimenUtil.dpiToPx(value.get(2)),
DimenUtil.dpiToPx(value.get(3)),
getDefaultPaint(LuaUtil.isTable(value.get(4)) ? value.get(4) : config));
}
}
}
}
}
}
示例7: drawTexts
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawTexts(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
CharSequence text = null;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 3) {
text = LuaUtil.toText(value.get(1));
if (!TextUtils.isEmpty(text)) {
canvas.drawText(text, 0, text.length(),
DimenUtil.dpiToPx(value.get(2)),
DimenUtil.dpiToPx(value.get(3)),
getDefaultPaint(LuaUtil.isTable(value.get(4)) ? value.get(4) : config));
}
}
}
}
}
}
}
示例8: score
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public int score(LuaValue value) {
switch ( value.type() ) {
case LuaValue.TTABLE:
return value.length()==0? 0: componentCoercion.score( value.get(1) );
case LuaValue.TUSERDATA:
return inheritanceLevels( componentType, value.touserdata().getClass().getComponentType() );
case LuaValue.TNIL:
return SCORE_NULL_VALUE;
default:
return SCORE_UNCOERCIBLE;
}
}
示例9: drawRoundRects
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawRoundRects(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
float x1, y1, dx, dy, x3, y3;
Paint paint = null;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 6) {
x1 = DimenUtil.dpiToPx(value.get(1));
y1 = DimenUtil.dpiToPx(value.get(2));
dx = DimenUtil.dpiToPx(value.get(3));
dy = DimenUtil.dpiToPx(value.get(4));
x3 = DimenUtil.dpiToPx(value.get(5));
y3 = DimenUtil.dpiToPx(value.get(6));
paint = getDefaultPaint(LuaUtil.isTable(value.get(7)) ? value.get(7) : config);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
canvas.drawRoundRect(x1, y1, x1 + dx, y1 + dy, x3, y3, paint);
} else {
drawRoundRectPlain(x1, y1, x1 + dx, y1 + dy, x3, y3, paint, canvas);
}
}
}
}
}
}
}
示例10: drawArcs
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawArcs(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
float x1, y1, dx, dy, x3, y3;
boolean use = false;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 7) {
x1 = DimenUtil.dpiToPx(value.get(1));
y1 = DimenUtil.dpiToPx(value.get(2));
dx = DimenUtil.dpiToPx(value.get(3));
dy = DimenUtil.dpiToPx(value.get(4));
x3 = (float) value.get(5).optdouble(0);
y3 = (float) value.get(6).optdouble(0);
use = value.get(7).optboolean(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
canvas.drawArc(x1, y1, x1 + dx, y1 + dy, x3, y3, use,
getDefaultPaint(LuaUtil.isTable(value.get(8)) ? value.get(8) : config));
} else {
final RectF rectF = mRectF;
rectF.left = x1;
rectF.top = y1;
rectF.right = x1 + dx;
rectF.bottom = y1 + dy;
canvas.drawArc(rectF, x3, y3, use, getDefaultPaint(config));
}
}
}
}
}
}
}
示例11: drawOvals
import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void drawOvals(Varargs varargs) {
final Canvas canvas = getCanvas();
if (canvas != null) {
final LuaTable table = LuaUtil.getTable(varargs, 2);
final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
if (table != null) {
final LuaValue[] keys = table.keys();
if (keys.length > 0) {
LuaValue value = null;
float x1, y1, dx, dy;
for (int i = 0; i < keys.length; i++) {
value = table.get(keys[i]);
if (value instanceof LuaTable && value.length() >= 4) {
x1 = DimenUtil.dpiToPx(value.get(1));
y1 = DimenUtil.dpiToPx(value.get(2));
dx = DimenUtil.dpiToPx(value.get(3));
dy = DimenUtil.dpiToPx(value.get(4));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
canvas.drawOval(x1, y1, x1 + dx, y1 + dy, getDefaultPaint(LuaUtil.isTable(value.get(5)) ? value.get(5) : config));
} else {
final RectF rectF = mRectF;
rectF.left = x1;
rectF.top = y1;
rectF.right = x1 + dx;
rectF.bottom = y1 + dy;
canvas.drawOval(rectF, getDefaultPaint(config));
}
}
}
}
}
}
}