Module process
The Process library provides an environment for managing and executing processes on the AO network.
It includes capabilities for handling messages, spawning processes, and customizing the environment with programmable logic and handlers. Returns the process table.
Functions
| Tab (msg) | Convert a message's tags to a table of key-value pairs |
| Prompt () | Generate a prompt string for the current process |
| print (a) | Print a value, formatting tables and converting non-string types |
| Send (msg) | Send a message to a target process |
| Spawn (args) | Spawn a new process |
| Receive (match) | Calls Handlers.receive with the provided pattern criteria, awaiting a message that matches the criteria. |
| Assign (assignment) | Assigns based on the assignment passed. |
| Version () | Prints the version of the process |
| handle (msg, _) | Main handler for processing incoming messages. |
Tables
| process | The process table |
Functions
- Tab (msg)
-
Convert a message's tags to a table of key-value pairs
Parameters:
- msg {table} The message containing tags
Returns:
-
{table}
A table with tag names as keys and their values
- Prompt ()
-
Generate a prompt string for the current process
Returns:
-
{string}
The custom command prompt string
- print (a)
-
Print a value, formatting tables and converting non-string types
Parameters:
- a {any} The value to print
- Send (msg)
-
Send a message to a target process
Parameters:
- msg {table} The message to send
- Spawn (args)
-
Spawn a new process
Parameters:
- args {...any} The arguments to pass to the spawn function
- Receive (match)
-
Calls Handlers.receive with the provided pattern criteria, awaiting a message that matches the criteria.
Parameters:
- match {table} The pattern criteria for the message
Returns:
-
{any}
The result of the message handling
- Assign (assignment)
-
Assigns based on the assignment passed.
Parameters:
- assignment {table} The assignment to be made
- Version ()
- Prints the version of the process
- handle (msg, _)
-
Main handler for processing incoming messages. It initializes the state, processes commands, and handles message evaluation and inbox management.
Parameters: