Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LadyCailin committed Jan 8, 2013
1 parent 284e124 commit 6d0fbec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/main/java/com/laytonsmith/core/functions/ArrayHandling.java
@@ -1,6 +1,7 @@
package com.laytonsmith.core.functions; package com.laytonsmith.core.functions;


import com.laytonsmith.PureUtilities.RunnableQueue; import com.laytonsmith.PureUtilities.RunnableQueue;
import com.laytonsmith.PureUtilities.StringUtils;
import com.laytonsmith.abstraction.StaticLayer; import com.laytonsmith.abstraction.StaticLayer;
import com.laytonsmith.annotations.api; import com.laytonsmith.annotations.api;
import com.laytonsmith.core.*; import com.laytonsmith.core.*;
Expand Down Expand Up @@ -1061,7 +1062,7 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
sortType = CArray.SortType.valueOf(args[1].val().toUpperCase()); sortType = CArray.SortType.valueOf(args[1].val().toUpperCase());
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new ConfigRuntimeException("The sort type must be one of either: REGULAR, NUMERIC, STRING, or STRING_IC", throw new ConfigRuntimeException("The sort type must be one of either: " + StringUtils.Join(CArray.SortType.values(), ", ", " or "),
ExceptionType.FormatException, t); ExceptionType.FormatException, t);
} }
ca.sort(sortType); ca.sort(sortType);
Expand All @@ -1083,7 +1084,7 @@ public String docs() {
+ " is passed in as a variable, the contents of that variable will be sorted, even if you don't re-assign" + " is passed in as a variable, the contents of that variable will be sorted, even if you don't re-assign"
+ " the returned array back to the variable. If you really need the old array, you should create a copy of" + " the returned array back to the variable. If you really need the old array, you should create a copy of"
+ " the array first, like so: assign(@sorted, array_sort(@array[])). The sort type may be one of the following:" + " the array first, like so: assign(@sorted, array_sort(@array[])). The sort type may be one of the following:"
+ " REGULAR, NUMERIC, STRING, STRING_IC. A regular sort sorts the elements without changing types first. A" + " " + StringUtils.Join(CArray.SortType.values(), ", ", " or ") + ". A regular sort sorts the elements without changing types first. A"
+ " numeric sort always converts numeric values to numbers first (so 001 becomes 1). A string sort compares" + " numeric sort always converts numeric values to numbers first (so 001 becomes 1). A string sort compares"
+ " values as strings, and a string_ic sort is the same as a string sort, but the comparision is case-insensitive." + " values as strings, and a string_ic sort is the same as a string sort, but the comparision is case-insensitive."
+ " If the array contains array values, a CastException is thrown; inner arrays cannot be sorted against each" + " If the array contains array values, a CastException is thrown; inner arrays cannot be sorted against each"
Expand Down Expand Up @@ -1113,7 +1114,7 @@ public ParseTree optimizeDynamic(Target t, List<ParseTree> children) throws Conf
try { try {
CArray.SortType.valueOf(children.get(1).getData().val().toUpperCase()); CArray.SortType.valueOf(children.get(1).getData().val().toUpperCase());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new ConfigCompileException("The sort type must be one of either: REGULAR, NUMERIC, STRING, or STRING_CI", t); throw new ConfigCompileException("The sort type must be one of either: " + StringUtils.Join(CArray.SortType.values(), ", ", " or "), t);
} }
} }
} }
Expand Down Expand Up @@ -1188,7 +1189,8 @@ public Integer[] numArgs() {
public String docs() { public String docs() {
return "void {array, [sortType], closure(array)} Works like array_sort, but does the sort on another" return "void {array, [sortType], closure(array)} Works like array_sort, but does the sort on another"
+ " thread, then calls the closure and sends it the sorted array. This is useful if the array" + " thread, then calls the closure and sends it the sorted array. This is useful if the array"
+ " is large enough to actually \"stall\" the server when doing the sort."; + " is large enough to actually \"stall\" the server when doing the sort. Sort type should be"
+ " one of " + StringUtils.Join(CArray.SortType.values(), ", ", " or ");
} }


public CHVersion since() { public CHVersion since() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/laytonsmith/tools/docgen/DocGen.java
Expand Up @@ -292,7 +292,7 @@ public int compare(FunctionBase o1, FunctionBase o2) {
} else if (type.equals("wiki")) { } else if (type.equals("wiki")) {
//Turn args into a prettified version //Turn args into a prettified version
out.append("|- id=\"" + f.getName() + "\"\n" out.append("|- id=\"" + f.getName() + "\"\n"
+ "! scope=\"row\" | [[CommandHelper/" + (staged?"Staged/":"") + "API/" + f.getName() + "|" + f.getName() + "]]\n" + "! scope=\"row\" | [[CommandHelper/" + (staged?"Staged/":"") + "API/" + f.getName() + "|" + f.getName() + "]]()\n"
+ "| " + di.ret + "\n" + "| " + di.ret + "\n"
+ "| " + di.args + "\n" + "| " + di.args + "\n"
+ "| " + thrown.toString() + "\n" + "| " + thrown.toString() + "\n"
Expand Down

0 comments on commit 6d0fbec

Please sign in to comment.