예제 #1
0
  public static Object[] toObjectArray(Varargs luaArgs, int luaStartIndex) {
    // Don't check upper bound -- otherwise varargs after an optional arg are annoying to use
    Checks.checkRange(luaStartIndex, "luaStartIndex", 1);

    Object[] result = new Object[luaArgs.narg() + 1 - luaStartIndex];
    for (int n = 0; n < result.length; n++) {
      result[n] = CoerceLuaToJava.coerceArg(luaArgs.arg(luaStartIndex + n), Object.class);
    }
    return result;
  }
예제 #2
0
 public static ILayer getLayerArg(Varargs args, int index) throws ScriptException {
   if (args.isuserdata(index)) {
     ILayer layer = args.touserdata(index, ILayer.class);
     if (layer != null) {
       return layer;
     }
   } else if (args.isnil(index)) {
     return null;
   }
   throw new ScriptException("Invalid layer arg: " + args.tojstring(1));
 }
예제 #3
0
 public static FilePath getPath(Varargs args, int index) {
   return getPath(args.arg(index));
 }