Environment

Returns all environment variables as a vector of EnvVariable records (fields: name, value). Use to inspect or forward the full environment.

pub fn env_variables() -> vector < EnvVariable >
pub fn env_variable(name: text) -> text

Returns the value of the environment variable name, or null if it is not set. Use to read configuration from the shell environment.

Functions for interacting with the host operating system. Returns the script-level arguments passed after the script path. Does not include the loft binary name or loft CLI flags.

pub fn arguments() -> vector < text >
pub fn byte_at(self: text, i: integer) -> integer

Returns the UTC calendar date `days` days before today, formatted as `YYYY-MM-DD`. Reuses `src/logger.rs::days_to_ymd`. Use for cutoff-date computation in time-window filters (e.g. "P-issues closed in the last 30 days"). Negative `days` clamps to today. Return the BYTE at position `i` (0..len) as integer 0-255, or 0 for out-of-bounds. Unlike `text[i]` which decodes the UTF-8 codepoint containing byte `i` (walking back through continuation bytes), `byte_at(i)` is a pure O(1) byte read. Use in ASCII-heavy scanning hot paths (tokenisers, regex- like loops) where the UTF-8 decode is wasted work — every non-ASCII byte still returns a valid 0-255 number; the caller compares against ASCII constants so byte semantics suffice. scan.loft (@PLAN37 phase 07 indexer) uses this for its per-byte tag scanner — ~5-10× speedup vs `text[i]` for pure ASCII checks.

pub fn ymd_days_ago(days: integer) -> text
pub fn directory(v:  & text = "") -> text

Returns the current working directory, optionally with v appended as a subpath. Use to construct absolute paths relative to where the program was launched.

pub fn user_directory(v:  & text = "") -> text

Returns the current user's home directory, optionally with v appended. Use for storing user-specific data or configuration.

pub fn program_directory(v:  & text = "") -> text

Returns the directory containing the running executable, optionally with v appended. Use to locate assets bundled alongside the program.

pub fn source_dir() -> text

Returns the directory containing the main source file being executed. Use to locate data files relative to the script, regardless of working directory.