Under development — the help is being filled in plugin by plugin.
Plugin reference

runtimeutil

Small runtime helpers — sleep, timestamp, local IPv4.

3 functionsnamespace runtimeutilsource plugins/runtime_util/RuntimeUtilPlugin.c

Written from a line-by-line source review; the deterministic example output is from a real run.

Introduction

The runtimeutil plugin provides a few commonly needed runtime helpers: you can wait for a given time (SleepMs), query the current local time as text (NowText), and find out one of the machine's local IPv4 addresses (LocalIPv4). The plugin is cross-platform (Linux and Windows) and stateless — every call is standalone.

Environment-dependent outputs

Two functions' output depends on the runtime environment: NowText gives the current date and time, and LocalIPv4 an address that depends on the machine's network configuration. So in this reference's examples we show the format, or a placeholder, instead of the actual value; SleepMs, by contrast, is deterministic (it returns the value given).

Loading the plugin

plugin "../plugins/print/PrintPlugin";
plugin "../plugins/runtime_util/RuntimeUtilPlugin";

A typical flow — timestamp and a short wait

string $now[64];
$now = runtimeutil.NowText();
printf("%s\n", $now);
runtimeutil.SleepMs(100); // wait 100 ms

What to know about every function (the basics)

  • SleepMs waits for the given milliseconds, then returns the value given. -1 means an “infinite” wait; any other negative value raises an error.

  • NowText gives the local time in the “YYYY-MM-DD HH:MM:SS.mmm” format (with millisecond precision).

  • LocalIPv4 gives a non-loopback (not 127.x.x.x) local IPv4 address, on a best-effort basis.

  • NowText and LocalIPv4 take no arguments; SleepMs takes a single integer parameter.

  • NowText's and LocalIPv4's output is environment-dependent (the time, and the network configuration, respectively).

  • An error (stopping the script) is caused by a wrong argument count or type, a negative SleepMs value other than -1, and a rare system-call failure.

How to read the signatures

milliseconds is the wait time given in milliseconds. The type after the -> arrow is the return type. For example, runtimeutil.SleepMs(milliseconds) -> int takes an integer value and returns the same after the wait.

Timing

Waiting for a given time and querying the current local time.

runtimeutil.SleepMs

runtimeutil.SleepMs(milliseconds) -> int

Waits for the given time (suspends the script), then returns the value given.

Parameters
Parameter Type Description
milliseconds int The wait time in milliseconds. -1 means an “infinite” wait; any other negative value is an error.
Return value

The value given (the milliseconds). For a negative value other than -1, a runtime error.

Example
printf("%d\n", runtimeutil.SleepMs(10));
Output after running
10
When to use

To insert a timed pause — for example a wait between two operations, scheduling polls, or simple rate control. 0 returns immediately, and -1 waits indefinitely (for example until awaiting an event).

runtimeutil.NowText

runtimeutil.NowText() -> string

Returns the current local time as text, with millisecond precision.

Parameters

This function takes no arguments.

Return value

The timestamp in the “YYYY-MM-DD HH:MM:SS.mmm” format (for example “2026-05-27 02:16:21.371”).

Example
printf("%s\n", runtimeutil.NowText());
Output after running
2026-05-27 02:16:21.371
When to use

For timestamping log entries, for measurements, or for displaying a time meant for human reading. The format is sortable and easy to process; the actual value of course depends on the time of the run.

Network

Querying one of the machine's local IPv4 addresses.

runtimeutil.LocalIPv4

runtimeutil.LocalIPv4() -> string

Returns a non-loopback local IPv4 address, based on the machine's network configuration.

Parameters

This function takes no arguments.

Return value

A local IPv4 address as text (for example “192.168.1.42”). The exact value depends on the network configuration.

Example
printf("%s\n", runtimeutil.LocalIPv4());
Output after running
<local IPv4 address>
When to use

To find out at what address the machine is reachable on the local network — for example to print the address when starting a server, or for diagnostic logging. It skips the loopback (127.x.x.x) address and looks for the actual network interface's address.

Practical notes

What the runtimeutil plugin is good for

  • Inserting timed pauses into the script's execution (SleepMs).

  • Timestamping log entries and measurements (NowText).

  • Finding out the machine's local network address (LocalIPv4) — for example when starting a server.

  • Simple, cross-platform runtime helpers, without an external dependency.

SleepMs — wait patterns

SleepMs suspends the given thread for the given time. 0 returns immediately (useful for briefly yielding control), a positive value waits for the given milliseconds, and -1 indefinitely (for example until another thread or event wakes the program). Any other negative value is an error. The return value is the value given, so the call can be chained or logged.

Timestamp format

NowText gives the local date and time in the “YYYY-MM-DD HH:MM:SS.mmm” form. This format is lexicographically sortable (an earlier time is also smaller as text), so it is suitable for sorting and comparing logs, not just for display.

Local IP address

LocalIPv4 looks for a non-loopback IPv4 address on a best-effort basis: it first inspects the network interfaces, then falls back to resolving the machine's name. With several interfaces or a complex network setup it gives the first appropriate address found — if you need the address of exactly a given interface, that is best determined by another route.

Error handling

A wrong argument count or type, a negative SleepMs value other than -1, and a rare system-call failure (for example the failure of querying the time or the network address) are reported by the runtime as a runtime error, and the script stops. On a successful call, SleepMs returns the value given, NowText the timestamp, and LocalIPv4 the address.

The gl thin OpenGL adapter

Classic OpenGL fixed-pipeline layer with its own window, event and texture handling — a self-contained GL surface