INCLUDE & SIDELOAD
INCLUDE executes a remote OQL file (URL or filesystem path) in the current scope. SIDELOAD executes an OQL string directly. Both share the calling scope — set variables are visible after the call.
| Verb | Description |
|---|---|
INCLUDE "url-or-path" | Fetch and execute an OQL script from a URL or /root/ path |
INCLUDE ?path_var SET ?result | Path or URL from a variable. SET captures the last RETURN value. |
SIDELOAD ?code_var SET ?result | Execute an OQL string value. Useful for dynamically generated code. |
INCLUDE from filesystem
WRITE `UPPER "hello" SET ?u AFTER EMIT ?u` INTO "/root/scripts/greet.oql"
AFTER INCLUDE "/root/scripts/greet.oql"
INCLUDE from URL
INCLUDE "https://scripts.example.com/utils.oql" SET ?result
AFTER EMIT ?result
Library pattern
(* /root/lib/auth.oql — checks session, sets ?current_user *)
(* SESSION !COOKIE(session) SET ?current_user *)
(* IF ?current_user IS NULL OPEN NEST STATUS 401 EXIT ALL CLOSE NEST *)
(* In your site pages: *)
INCLUDE "/root/lib/auth.oql"
AFTER EMIT "Hello, " & ?current_user(username)
SIDELOAD — dynamic execution
STRING `UPPER "` & !REQUEST(form:input) & `" SET ?r AFTER RETURN ?r` SET ?code
AFTER SIDELOAD ?code SET ?result
AFTER EMIT ?result