run

Run a procedure.

This function does not generate an event.

Function

run(procedure, ...args)

Arguments

Argument Type Description
procedure str (required) Name of the procedure to run.
…args any The arguments for the procedure. If more arguments are given than the procedure expects, the redundant arguments will be ignored. If too few arguments are given, then the remaining arguments will be set to nil.

Return value

Returns the procedure response.

Example

Example code using run:

// create a greet procedure
new_procedure('greet', |name| isstr(name)
    ? "Hello " + name
    : "Hello unnamed user!"
);

// run `greet` with a given name
greet_iris = run('greet', "Iris");

// run `greet` with nil
greet_nil = run('greet', nil);

// return the greet response values
[greet_iris, greet_nil];

Return value in JSON format

[
    "Hello Iris",
    "Hello unnamed user!"
]