mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
add varargs to print() and println() (#2056)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user