當前位置: 首頁>>代碼示例>>Java>>正文


Java LuaValue.istable方法代碼示例

本文整理匯總了Java中org.luaj.vm2.LuaValue.istable方法的典型用法代碼示例。如果您正苦於以下問題:Java LuaValue.istable方法的具體用法?Java LuaValue.istable怎麽用?Java LuaValue.istable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.luaj.vm2.LuaValue的用法示例。


在下文中一共展示了LuaValue.istable方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCellClicked

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
/**
 * 調用 Callback 方法
 *
 * @param cell
 * @param position
 * @return
 */
public LuaValue onCellClicked(LuaValue cell, int position) {
    final int section = getSectionByPosition(position);
    final int row = getRowInSectionByPosition(position);
    final String id = getId(position, section, row);
    final LuaValue cellData = getCell(id);
    if (cellData != null) {
        final LuaValue callback = cellData.get("Callback");
        if (callback.isfunction()) {
            return LuaUtil.callFunction(callback, cell, LuaUtil.toLuaInt(section), LuaUtil.toLuaInt(row));
        } else if (callback.istable()) {
            return LuaUtil.callFunction(LuaUtil.getFunction(callback, "Click", "click"), cell, LuaUtil.toLuaInt(section), LuaUtil.toLuaInt(row));
        }
    }
    return NIL;
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:23,代碼來源:UDBaseListOrRecyclerView.java

示例2: getGenericListFromTable

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
/**
 * Transforming a table of LUA values to a array list of generic data types.
 * @param table The table.
 * @param mapper The mapper.
 * @param <T> The generic type.
 * @return The mapped arraylist.
 */
private static <T> ArrayList<T> getGenericListFromTable(LuaValue table, LuaValueMapper<T> mapper) {
	ArrayList<T> generics = new ArrayList<T>();
	if (!table.isnil() && table.istable()) {
		int i = 1;
		while (true) {
			LuaValue v = table.get(i);
			if (v.isnil()) {
				break;
			}
			generics.add(mapper.map(v));
			i++;
		}
	}
	return generics;
}
 
開發者ID:joakimkistowski,項目名稱:HTTP-Load-Generator,代碼行數:23,代碼來源:LuaHelpers.java

示例3: onCellLongClicked

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
/**
 * 調用 Callback 方法
 *
 * @param cell
 * @param position
 * @return
 */
public boolean onCellLongClicked(LuaValue cell, int position) {
    final int section = getSectionByPosition(position);
    final int row = getRowInSectionByPosition(position);
    final String id = getId(position, section, row);
    final LuaValue cellData = getCell(id);
    if (cellData != null) {
        final LuaValue callback = cellData.get("Callback");
        if (callback != null && callback.istable()) {
            return LuaUtil.callFunction(LuaUtil.getFunction(callback, "LongClick", "longClick"), cell, LuaUtil.toLuaInt(section), LuaUtil.toLuaInt(row)).optboolean(false);
        }
    }
    return false;
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:21,代碼來源:UDBaseListOrRecyclerView.java

示例4: ReadOnlyLuaTable

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public ReadOnlyLuaTable(LuaValue table) {
	presize(table.length(), 0);
	for (Varargs n = table.next(LuaValue.NIL); !n.arg1().isnil(); n = table.next(n.arg1())) {
		LuaValue key = n.arg1();
		LuaValue value = n.arg(2);
		super.rawset(key, value.istable() ? new ReadOnlyLuaTable(value) : value);
	}
}
 
開發者ID:hamilton-lima,項目名稱:robolucha,代碼行數:9,代碼來源:LuaVM.java

示例5: ReadOnlyLuaTable

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public ReadOnlyLuaTable(LuaValue table) {
	presize(table.length(), 0);
	Varargs m = table.next(LuaValue.NIL);
	boolean nIsNil = !m.arg1().isnil();
	for (Varargs n = m; nIsNil; n = table.next(n.arg1()), nIsNil = !n.arg1().isnil()) {
		LuaValue key = n.arg1();
		LuaValue value = n.arg(2);
		super.rawset(key, value.istable() ? new ReadOnlyLuaTable(value) : value);
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:11,代碼來源:ReadOnlyLuaTable.java

示例6: tableSize

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
/**
 * Getting the size of a LUA Value table.
 * @param table a LUA table.
 * @return Size of the table.
 */
public static int tableSize(LuaValue table) {
	int i = 1;
	if (!table.isnil() && table.istable()) {
		while (true) {
			LuaValue v = table.get(i);
			if (v.isnil()) {
				break;
			}
			i++;
		}
	}
	return i - 1;
}
 
開發者ID:joakimkistowski,項目名稱:HTTP-Load-Generator,代碼行數:19,代碼來源:LuaHelpers.java

示例7: ReadOnlyLuaTable

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
public ReadOnlyLuaTable(LuaValue table) {
  presize(table.length(), 0);
  for (Varargs n = table.next(LuaValue.NIL); !n.arg1().isnil(); n = table
          .next(n.arg1())) {
    LuaValue key = n.arg1();
    LuaValue value = n.arg(2);
    super.rawset(key, value.istable() ? new ReadOnlyLuaTable(value) : value);
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:10,代碼來源:ReadOnlyLuaTable.java

示例8: initSpannableStringBuilder

import org.luaj.vm2.LuaValue; //導入方法依賴的package包/類
private void initSpannableStringBuilder(LuaValue text, LuaValue config) {
    SpannableStringBuilder spannableStringBuilder = getSpannableStringBuilder();
    if (text != null && text.isstring()) {
        spannableStringBuilder = spannableStringBuilder.append(text.tojstring());
    }

    if (spannableStringBuilder.length() > 0) {
        if (config != null && config.istable()) {
            final int end = spannableStringBuilder.length();
            final int fontSize = DimenUtil.spToPx(config.get("fontSize").optint(-1));
            final Integer fontColor = ColorUtil.parse(LuaUtil.getValue(config, "fontColor"));
            final String fontName = config.get("fontName").optjstring(null);

            final LuaValue weightValue = config.get("fontWeight");
            final int fontWeight = LuaUtil.isNumber(weightValue) ? weightValue.optint(UDFontWeight.WEIGHT_NORMAL_INT) : UDFontWeight.getValue(weightValue.optjstring(UDFontWeight.WEIGHT_NORMAL));

            final LuaValue styleValue = config.get("fontStyle");
            final int fontStyle = LuaUtil.isNumber(styleValue) ? styleValue.optint(Typeface.NORMAL) : UDFontStyle.getValue(styleValue.optjstring(UDFontStyle.STYLE_NORMAL));

            final Integer backgroundColor = ColorUtil.parse(LuaUtil.getValue(config, "backgroundColor"));
            final boolean strikethrough = config.get("strikethrough").optboolean(false);
            final boolean underline = config.get("underline").optboolean(false);

            if (fontSize != -1) {//字體大小
                spannableStringBuilder.setSpan(new AbsoluteSizeSpan(fontSize), 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (fontColor != null) {//字體顏色
                spannableStringBuilder.setSpan(new ForegroundColorSpan(fontColor), 0, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (fontName != null && getLuaResourceFinder() != null) {//字體
                spannableStringBuilder.setSpan(new CustomTypefaceSpan(fontName, getLuaResourceFinder().findTypeface(fontName)), 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (fontWeight != -1 && fontWeight > UDFontWeight.WEIGHT_NORMAL_INT) {//文字Weight
                spannableStringBuilder.setSpan(new WeightStyleSpan(fontWeight), 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (fontStyle != -1 && (fontStyle >= Typeface.NORMAL && fontStyle <= Typeface.BOLD_ITALIC)) {//文字樣式
                spannableStringBuilder.setSpan(new StyleSpan(fontStyle), 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (backgroundColor != null) {//背景色
                spannableStringBuilder.setSpan(new BackgroundColorSpan(backgroundColor), 0, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (strikethrough) {//刪除線
                spannableStringBuilder.setSpan(new StrikethroughSpan(), 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (underline) {//下劃線
                spannableStringBuilder.setSpan(new UnderlineSpan(), 0, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }
        }
    }
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:58,代碼來源:UDSpannableString.java


注:本文中的org.luaj.vm2.LuaValue.istable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。