Guide Index Previous Part Next Part Download Markdown

#Part 5. Libraries

#Part 5 Section 1. Learn These First

Most first apps need only a small library set.

LibraryPurpose
CB-ConsoleInput and terminal output
CB-MathChecked numeric helpers and fallbacks
CB-Storage.cb saves
CB-AssetLoaderProject assets
CB-UIHTML UI
CB-RenderDirect drawing
CB-PopupUser-facing error dialogs
CB-Networking.HTTPOutgoing web requests
CB-Networking.APILocal routes or API clients
CB-Security.AuthLogin/session checks
CB-Security.RBACRole checks
CB-Library.TestingAssertions and small benchmarks
CB-Library.LoggingDebug logs

Import the libraries you use. A short import list makes missing functions easier to spot.

#Part 5 Section 2. Making A Library

A .cbl library should do one job clearly. Export stable functions and build it with compile library.

library CB-TextTools

fn CB-TextTools.slug(string text) -> string {
    string lower = string.lower(text)
    return string.replace(lower, " ", "-")
}
compile library CB-TextTools.cbp bin/CB-TextTools.cbl small compute

Place the compiled .cbl in the project libraries folder, then import it from another .cbp.

#Part 5 Section 3. Shipped Library Map

Declare a shipped library at the top of the file with library CB-Name;, then call functions through its namespace. For example:

library CB-Storage;

fn main() {
    CB-Storage.write_text("settings.cb", "theme=dark");
}

The table covers every library shipped with Coding Studio. The interactive library source catalog shows the exact callable functions and copyable source for each one.

AreaLibrariesHow to use them
App and game logicCB-Action, CB-Breakable, CB-Pathfinding, CB-PhysicsInput cooldowns, damage state, grid routes, integration, collision, and rigid-body helpers.
AI and understandingCB-AI.Heuristics, CB-AI.Pattern, CB-AI.Search, CB-Generation, CB-Generation.Image, CB-Generation.Response, CB-Generation.Text, CB-GenerationOptimized, CB-Parsing, CB-Understanding, CB-Understanding.Image, CB-Understanding.Language, CB-Understanding.LogicPrepare/search indexed data, normalize text, score intent, and use the specialized generation/understanding namespaces.
Assets, data, and savesCB-AssetLoader, CB-Cache.Local, CB-Data, CB-Data.CSV, CB-Data.TOML, CB-Data.XML, CB-Data.YAML, CB-Database.Local, CB-FileSystem.Path, CB-FileSystem.Storage, CB-FileSystem.Watch, CB-StorageRead packaged assets, classify/transform formats, manage paths, and save validated mutable data in .cb containers.
Graphics and mediaCB-Audio, CB-GPU, CB-Graphics.2D, CB-Graphics.3D, CB-Graphics.Font, CB-Multimedia.Audio, CB-Multimedia.Image, CB-Multimedia.Video, CB-Render, CB-Shader, CB-TextToSpeech, CB-TextToSpeech.Voices, CB-UICreate native windows, draw scenes, query GPU state, load media, play audio, speak text, or open HTML/CSS app UI.
Core helpersCB-Bit, CB-Console, CB-Math, CB-Math.Basic, CB-Math.Linear, CB-Math.Random, CB-Time, CB-Time.SchedulerUse bit flags, terminal I/O, checked math, vectors/random helpers, clocks, sleeps, and scheduled work.
Library toolingCB-Library.Compression, CB-Library.Config, CB-Library.Cryptography, CB-Library.DataStructures, CB-Library.Logging, CB-Library.Serialization, CB-Library.Testing, CB-Library.ValidationAdd focused helpers for configuration, data structures, logs, serialization, tests, validation, compression, and cryptographic workflows.
NetworkingCB-Network, CB-Networking.API, CB-Networking.DNS, CB-Networking.HTTP, CB-Networking.Socket, CB-Networking.WebSocketMake HTTP/HTTPS requests, join API endpoints, match local routes, and use DNS/socket/WebSocket namespaces where the runtime surface supports them.
Runtime, security, and systemCB-Popup, CB-Runtime, CB-Security.Auth, CB-Security.RateLimit, CB-Security.RBAC, CB-System.Env, CB-System.OS, CB-System.TimerShow native warnings, inspect runtime budgets, enforce authentication/rate/role rules, and query environment, OS, or timer helpers.

Some specialized namespaces currently expose readiness or planning helpers while their deeper runtime surface is developed. Check the source catalog before depending on a particular function; the source is the authoritative callable API.