Java Code Examples for org.luaj.vm2.LuaTable#length()
The following examples show how to use
org.luaj.vm2.LuaTable#length() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIImageViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
/** * 开始帧动画 * * @param view * @param varargs 时间是秒而不是毫秒 * @return */ @Deprecated public LuaValue startAnimationImages(U view, Varargs varargs) {//TODO 支持UDImageView和UDBitmap final LuaTable imagesTable = varargs.opttable(2, null); final double duration = varargs.optdouble(3, 1f); boolean repeat = false; if (varargs.isnumber(4)) { repeat = varargs.optint(4, -1) > 0; } else { repeat = varargs.optboolean(4, false); } if (imagesTable != null && imagesTable.length() > 0) { final String[] images = new String[imagesTable.length()]; int i = 0; for (LuaValue key : imagesTable.keys()) { images[i++] = imagesTable.get(key).optjstring(null); } return view.startAnimationImages(images, (int) duration * 1000, repeat); } return view; }
Example 2
Source File: SpellFactory.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
@NotNull public static ArrayList<String> getSpellsByAffinity(String affinity) { LuaTable luaList = script.run("getSpellsList", affinity).checktable(); ArrayList<String> spellList = new ArrayList<>(); if(mSpellsByAffinity.containsKey(affinity)) { spellList.addAll(mSpellsByAffinity.get(affinity)); } for (int i = 1;i<=luaList.length();i++) { spellList.add(luaList.rawget(i).checkjstring()); } return spellList; }
Example 3
Source File: SpellFactory.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
@NotNull public static ArrayList<String> getAllSpells() { LuaTable luaList = script.run("getSpellsList").checktable(); ArrayList<String> spellList = new ArrayList<>(); for(var aff: mSpellsByAffinity.values()) { spellList.addAll(aff); } for (int i = 1;i<=luaList.length();i++) { spellList.add(luaList.rawget(i).checkjstring()); } return spellList; }
Example 4
Source File: TableLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { LuaTable table = args.checktable(1); int size = table.length(); int pos = args.optint(2, size); if (pos != size && (pos < 1 || pos > size + 1)) { argerror(2, "position out of bounds: " + pos + " not between 1 and " + (size + 1)); } return table.remove(pos); }
Example 5
Source File: TableLib.java From luaj with MIT License | 4 votes |
public Varargs invoke(Varargs args) { LuaTable t = args.checktable(1); // do not waste resource for calc rawlen if arg3 is not nil int len = args.arg(3).isnil() ? t.length() : 0; return t.unpack(args.optint(2, 1), args.optint(3, len)); }