public static void clearTable(LuaValue table) { LuaValue k = LuaValue.NIL; while (true) { Varargs n = table.next(k); if ((k = n.arg1()).isnil()) break; table.set(k, LuaValue.NIL); } }
public static void copyTable(LuaValue src, LuaValue dst) { LuaValue k = LuaValue.NIL; while (true) { Varargs n = src.next(k); if ((k = n.arg1()).isnil()) break; dst.set(k, n.arg(2)); } }
@Override public Varargs invoke(Varargs args) { LuaValue key = args.arg(2); Varargs newargs = varargsOf(args.arg(1), args.arg(3)); LuaValue func = metatable.get(key); if (func.isfunction()) { // 函数调用 func.invoke(newargs); } else { LogUtil.d("[LuaView error]", "property not fount :", key.toString()); } return NONE; }
@Override public LuaValue invoke(Varargs args) { LuaValue arg1 = args.arg(1); LuaValue arg2 = args.arg(2); List<String> vals = new ArrayList<String>(); for (int i = 3; !args.arg(i).isnil(); i++) { vals.add(args.arg(i).checkjstring()); } return LuaValue.valueOf( LuaConverters.encode( arg1.checkjstring(), arg2.isboolean() ? arg2.toboolean() : true, vals.toArray(new String[0]))); }
static Text obj(Varargs args) { return convert(args.arg1()).getObject(); }