#Part 5. Libraries
#Part 5 Section 1. Learn These First
Most first apps need only a small library set.
| Library | Purpose |
|---|---|
CB-Console | Input and terminal output |
CB-Math | Checked numeric helpers and fallbacks |
CB-Storage | .cb saves |
CB-AssetLoader | Project assets |
CB-UI | HTML UI |
CB-Render | Direct drawing |
CB-Popup | User-facing error dialogs |
CB-Networking.HTTP | Outgoing web requests |
CB-Networking.API | Local routes or API clients |
CB-Security.Auth | Login/session checks |
CB-Security.RBAC | Role checks |
CB-Library.Testing | Assertions and small benchmarks |
CB-Library.Logging | Debug 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.
| Area | Libraries | How to use them |
|---|---|---|
| App and game logic | CB-Action, CB-Breakable, CB-Pathfinding, CB-Physics | Input cooldowns, damage state, grid routes, integration, collision, and rigid-body helpers. |
| AI and understanding | CB-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.Logic | Prepare/search indexed data, normalize text, score intent, and use the specialized generation/understanding namespaces. |
| Assets, data, and saves | CB-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-Storage | Read packaged assets, classify/transform formats, manage paths, and save validated mutable data in .cb containers. |
| Graphics and media | CB-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-UI | Create native windows, draw scenes, query GPU state, load media, play audio, speak text, or open HTML/CSS app UI. |
| Core helpers | CB-Bit, CB-Console, CB-Math, CB-Math.Basic, CB-Math.Linear, CB-Math.Random, CB-Time, CB-Time.Scheduler | Use bit flags, terminal I/O, checked math, vectors/random helpers, clocks, sleeps, and scheduled work. |
| Library tooling | CB-Library.Compression, CB-Library.Config, CB-Library.Cryptography, CB-Library.DataStructures, CB-Library.Logging, CB-Library.Serialization, CB-Library.Testing, CB-Library.Validation | Add focused helpers for configuration, data structures, logs, serialization, tests, validation, compression, and cryptographic workflows. |
| Networking | CB-Network, CB-Networking.API, CB-Networking.DNS, CB-Networking.HTTP, CB-Networking.Socket, CB-Networking.WebSocket | Make HTTP/HTTPS requests, join API endpoints, match local routes, and use DNS/socket/WebSocket namespaces where the runtime surface supports them. |
| Runtime, security, and system | CB-Popup, CB-Runtime, CB-Security.Auth, CB-Security.RateLimit, CB-Security.RBAC, CB-System.Env, CB-System.OS, CB-System.Timer | Show 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.
