Пример #1
0
 @Override
 public LuaValue call(LuaValue pnts, LuaValue p) {
   Zone zone = MapTool.getFrame().getCurrentZoneRenderer().getZone();
   if (!token.isSelfOrTrusted()) {
     throw new LuaError(
         new ParserException(
             I18N.getText("macro.function.general.noPerm", "token.movedOverPoints")));
   }
   String points = pnts.checkjstring();
   if (p.isnil()) {
     Path<?> path = token.getToken().getLastPath();
     return LuaConverters.fromJson(
         TokenMoveFunctions.pathPointsToJSONArray(
             TokenMoveFunctions.crossedPoints(
                 zone, token.getToken(), points, TokenMoveFunctions.getLastPathList(path, true))));
   } else {
     String jsonPath = ObjectUtils.toString(LuaConverters.toJson(p));
     return LuaConverters.fromJson(
         TokenMoveFunctions.pathPointsToJSONArray(
             TokenMoveFunctions.crossedPoints(zone, token.getToken(), points, jsonPath)));
   }
 }
Пример #2
0
 @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])));
 }