Beispiel #1
0
 public void testJseOsGetenvForEnvVariables() {
   LuaValue USER = LuaValue.valueOf("USER");
   LuaValue jse_user = jse_lib.get("getenv").call(USER);
   LuaValue jme_user = jme_lib.get("getenv").call(USER);
   assertFalse(jse_user.isnil());
   assertTrue(jme_user.isnil());
   System.out.println("User: " + jse_user);
 }
Beispiel #2
0
 /**
  * get text of given value
  *
  * @param inputValue
  * @return
  */
 public static CharSequence getText(LuaValue inputValue) {
   final LuaValue result = (inputValue != null && !inputValue.isnil()) ? inputValue : LuaValue.NIL;
   if (result instanceof UDSpannableString) {
     return ((UDSpannableString) result).getSpannableStringBuilder();
   } else if (result instanceof UDUnicode) {
     return result.toString();
   } else {
     return result.optjstring("");
   }
 }
 @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)));
   }
 }