Docs/native libraries
NATIVE LIBRARIES

Native libraries. Useful building blocks.

62 functions for text, numbers, files, lists, native windows and CHUD-specific helpers.

Familiar tasks, native CHUD.

These original CHUD libraries borrow familiar Python/C# ideas without embedding either runtime. Use fully qualified calls. Imports validate available library names; Python imports, C# assemblies and Unity packages are not supported.

CHUD
use CHUD.Text;
CHUD.Print(CHUD.Text.Upper(CHUD.Text.Trim("  hello CHUD  ")));
CHUD.Print(CHUD.Text.Length("A🟣é"));
CHUD.Print(CHUD.Text.Slice("A🟣é", 1, 2));

Choose a library.

LibraryBehavior and contracts
CHUD.MathAbs, Min, Max, Clamp, Pow, Gcd. Signed int arithmetic; Clamp is inclusive, Pow requires a nonnegative exponent. Invalid ranges and overflow fail. Pow(0,0) is 1.
CHUD.TextLength and Slice count Unicode code points, not grapheme clusters. Slice takes start + count with checked bounds. Concat, Contains, StartsWith, EndsWith, Replace and Repeat operate on UTF-8. Replace rejects an empty search. Upper/Lower change ASCII letters and preserve other characters; Trim removes ASCII whitespace.
CHUD.ConvertToString formats an int. ToInt accepts an optional sign followed by decimal digits with no surrounding whitespace; invalid/out-of-range text fails. IsInt checks the same rule without throwing.
CHUD.IOReadLine reads stdin without the newline, returning empty text at EOF. ReadText accepts UTF-8, non-NUL files up to 16 MiB. WriteText replaces; AppendText creates/appends; Exists checks files or directories. UTF-8 paths work on Windows. Relative paths use the process working directory. No directories are created automatically.
CHUD.PathLexical Combine, FileName, Extension and DirectoryName accept / or backslash. An absolute second path replaces the first. Extension includes the dot, or is empty (including a lone leading dot). A trailing separator has an empty FileName. These calls do not access or sandbox the filesystem.
CHUD.RandomSeed makes repeatable sequences. Range includes its minimum and excludes its maximum; minimum must be smaller. Without Seed, initialization uses clock/process information. Intended for games and examples, not cryptography.
CHUD.TimeNow returns Unix seconds within signed int range. Millis is monotonic from its first call and wraps after 2^31 milliseconds (about 24.9 days). Sleep blocks the calling thread for nonnegative milliseconds.
CHUD.CollectionsMutable typed integer lists: New, Add, Get, Set, Count, RemoveAt, Clear, Contains, Sort and Sum. Zero-based checked indexes. Sort mutates in ascending order. Assignment/passing aliases; equality tests identity. Sum checks final-result overflow. Maximum one million integers per list.
CHUD.ForgeOriginal game helpers. Wrap uses an exclusive upper bound and handles negative input. StepToward moves by a nonnegative step without overshooting. Lerp clamps an integer percentage to 0..100 and truncates integer division toward zero.
CHUD.SparkOriginal console helpers. Bar(value, maximum, width) returns [###---] with values clamped, a positive maximum and width 1..200. Badge(text) returns [ text ].
CHUD.GUI / CHUD.GUILayoutA native Windows frame loop and manual or vertical controls. See the immediate-mode GUI guide.

See every function signature for argument order and types. CHUD.Core console functions are documented separately.

Real integer collections.

CHUD
use CHUD.Collections;
let scores: list = CHUD.Collections.New();
CHUD.Collections.Add(scores, 42);
CHUD.Collections.Add(scores, 17);
CHUD.Collections.Sort(scores);
CHUD.Print(CHUD.Collections.Get(scores, 0));
CHUD.Print(CHUD.Collections.Sum(scores));

This prints 17 and 59. A let list can still be mutated; let prevents rebinding. Lists can be passed and returned from typed functions. There is no index or generic-list syntax.

Made for CHUD.

CHUD
use CHUD.Forge;
use CHUD.Spark;
mut health = 10;
for tick in 0..5 {
    health = CHUD.Forge.StepToward(health, 100, 18);
    CHUD.Print(CHUD.Spark.Bar(health, 100, 20));
}

Forge handles small integer game mechanics; Spark provides simple console formatting. They are independent CHUD APIs.

Know where values live.

Repeated allocation in an infinite loop can exhaust the budget. Clear retains list capacity. Use GUILayout.Value to display changing numbers without allocating CHUD strings each frame. Invalid bounds, conversions, library overflow, IO errors and budget failures report a CHUD Runtime error and exit with code 70.

ReadLine works in an external terminal. Studio captures output but currently does not supply interactive stdin. The built-in starters avoid requiring console input.

Open an example.

POWERSHELL
cd examples/LibraryTour
chud run

Or open the example folder in Studio. Basic assistant can also generate text, list, dice, file, GUI, game and timer starters.

Updated October 30, 2026 · 0.1.0-alpha · Windows x64

Search language syntax, setup, Studio, and more.

CHUD DOCUMENTATION↑ ↓ to navigate · Enter to open