Skip to main content

Functions and Includes

function — Function definition

Full reference →

A function in iXML is a closed subroutine — a named, reusable block of code that executes in its own isolated local context.

Syntax

XML
<function var="myFunction">
<use name="closureVarName" var="outerVar"/>

<!-- function body -->
<set var="return">result value</set>
</function>

Context Isolation

The critical characteristic of a function is context isolation. When a function is called, iXML creates a fresh local context. Variables declared inside are invisible outside, and vice versa, unless explicitly bound.

Special Local Variables

VariableDescription
thisReference to the calling object (if called as a method).
returnThe return value. Defaults to NULL.
argumentsArray containing all passed parameters.

call — Call function

Full reference →

Invokes a function. Execution transfers to the function and returns when complete.

Syntax

XML
<call func="functionName" var="resultVar">
<param name="paramName">value</param>
</call>

Attributes

NameTypeDescription
funcvarFunction variable to call.
varvarVariable to store the return value.
var_paramsvarArray variable containing parameters.
var_thisvarExplicitly bind this context.

include — Include code source

Full reference →

Executes code from an external resource file.

Syntax

XML
<include id="resource.id" [var="classVar"] [once="true"]>
<param name="paramName">value</param>
</include>

Description

include loads and executes the content of a ZeyOS resource. It is the primary way to modularize code into separate files.

  • By default, includes execute in a new local context (like a function call).
  • Parameter passing works exactly like <call>.
  • Use once="true" to prevent re-loading the same library multiple times.