Plugins can register expression functions that are callable from any RWML attribute value, event handler, or inline script. Exported functions follow the same calling convention as built-in functions: they receive an ordered list of evaluated arguments and the current variable storage, and return a value that the expression engine substitutes at the call site. This lets you extend RWML with side-effecting operations or computed values that the built-in function set does not cover.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ryzhpolsos/redeye/llms.txt
Use this file to discover all available pages before exploring further.
Function signature
Every exported function must conform to the following delegate type:- First parameter (
IEnumerable<object> args) — the evaluated arguments passed by the caller, in order. - Second parameter (
IVariableStorage<string> varStorage) — the variable storage of the expression context where the function was called. - Return value (
object) — the value substituted at the call site. Returnstring.Emptyfor side-effect-only functions.
Exporting a function
Write the function implementation
Define the function inline in
Main() or as a separate method. Use args.ElementAt(n) to read positional arguments and args.Count() to check how many were supplied.Access arguments safely
Arguments are passed as
object values. Always call .ToString() or cast with a null check. Use args.Count() before calling ElementAt when the argument count is variable.Read variables from the calling context (optional)
varStorage exposes the variable scope of the RWML node that triggered the call. Use varStorage.GetVariable(name) to read layout variables like ${window.title} or custom variables set by <var> elements.Return a value or string.Empty
For functions that produce a value (used in an expression like
my-plugin.formatBytes(${file.size})), return the computed value as a string or a type the expression engine can convert. For side-effect-only functions (like killing a process), return string.Empty so the call site is replaced with an empty string.Real example — killProcess from the built-in taskbar
The built-intaskbar.xml layout exports a killProcess function directly from an inline <script> block. The pattern is identical to what a plugin does: call PluginManager.ExportFunction with a function that reads a window handle from args.ElementAt(0).
The inline script version does not qualify the name with a plugin ID. When exporting from a plugin, the full call name is always
pluginId.functionName.Argument patterns summary
| Scenario | Code |
|---|---|
| Read first argument | args.ElementAt(0)?.ToString() |
| Read second argument | args.ElementAt(1)?.ToString() |
| Count arguments | args.Count() |
| Skip first argument | args.Skip(1) |
| Read a layout variable | varStorage.GetVariable("window.title") |
| No return value needed | return string.Empty; |