add varargs to print() and println() (#2056)

This commit is contained in:
Ben Fry
2013-10-11 18:25:41 -04:00
parent a9097a8962
commit ef93f09b9c
2 changed files with 28 additions and 2 deletions
+26 -2
View File
@@ -4380,6 +4380,23 @@ public class PApplet extends Applet
System.out.flush();
}
static public void print(Object... variables) {
StringBuilder sb = new StringBuilder();
for (Object o : variables) {
if (sb.length() != 0) {
sb.append(" ");
}
if (o == null) {
sb.append("null");
} else {
sb.append(o.toString());
}
}
System.out.print(sb.toString());
}
static public void print(Object what) {
if (what == null) {
// special case since this does fuggly things on > 1.1
@@ -4389,8 +4406,8 @@ public class PApplet extends Applet
}
}
//
/**
/**
* ( begin auto-generated from println.xml )
*
* Writes to the text area of the Processing environment's console. This is
@@ -4458,6 +4475,13 @@ public class PApplet extends Applet
System.out.flush();
}
static public void println(Object... variables) {
print(variables);
println();
}
static public void println(Object what) {
if (what == null) {
// special case since this does fuggly things on > 1.1
+2
View File
@@ -15,6 +15,8 @@ X https://github.com/processing/processing/pull/2070
X Java2D images crash after being resized
X https://github.com/processing/processing/issues/2113
X constrain lerpColor() between 0 and 1
X allow println() and print() to take varargs
X https://github.com/processing/processing/issues/2056
_ JSONObject/Array.format(-1) not working on embedded JSONObjects
_ should be a quick fix, notes are in the report