These functions write output, build formatted text, work with clipboard text, control output, or intentionally raise user errors.
Clears the active output target when possible.
| Argument | Type | Description |
|---|---|---|
| none | No arguments. |
Returns: OK result.
Example:
clear(); print('Output was cleared');
Enables or disables output for the current output sink.
| Argument | Type | Description |
|---|---|---|
| `enabled` | any | Converted to bool. True enables output; false disables output. |
Returns: boolean-style number with the new enabled state.
Example:
enable_print(false); print('hidden'); enable_print(true); print('visible');
Builds an error message from all arguments and raises a user error.
| Argument | Type | Description |
|---|---|---|
| `value` | any | First value to append to the message. Optional. |
| `…` | any | Additional values appended to the message. |
Returns: does not return normally.
Example:
if(feed <= 0) { error('Invalid feed: ', feed); };
Reads text from the system clipboard.
| Argument | Type | Description |
|---|---|---|
| none | No arguments. |
Returns: string.
Example:
text = from_clipboard(); print(text);
Writes values to the current output stream and appends a newline.
| Argument | Type | Description |
|---|---|---|
| `value` | any | First value to print. Optional. |
| `…` | any | Additional values printed without an automatic separator. |
Returns: OK result.
Example:
print('X=', x, ', Y=', y);
Formats values, writes the result to output, and appends a newline.
| Argument | Type | Description |
|---|---|---|
| `format` | string | Format string using brace-style placeholders. Optional; if omitted, only a newline is written. |
| `value` | any | First formatted value. Optional. |
| `…` | any | Additional formatted values. |
Returns: OK result.
Example:
printf('X={}, Y={}', x, y); printf('Tool {:d}', toolNumber);
Integer format specifiers convert numeric arguments to integer values before formatting.
Builds and returns text from all arguments.
| Argument | Type | Description |
|---|---|---|
| `value` | any | First value. Optional. |
| `…` | any | Additional values appended without an automatic separator. |
Returns: string.
Example:
text = sprint('X=', x, ', Y=', y);
Formats values and returns the formatted text.
| Argument | Type | Description |
|---|---|---|
| `format` | string | Format string using brace-style placeholders. Optional; if omitted, returns an empty string. |
| `value` | any | First formatted value. Optional. |
| `…` | any | Additional formatted values. |
Returns: string.
Example:
line = sprintf('X={}, Y={}', x, y);
Writes text to the system clipboard.
| Argument | Type | Description |
|---|---|---|
| `value` | any | Value converted to string and copied to clipboard. |
Returns: boolean-style result from the host clipboard operation.
Example:
to_clipboard('Copied text');
Previous: Strings
Next: Dialog Functions