BT standard library
The packages every BT program can use, in games and tools alike: printing,
text, math, files, time, networking and more. Include a package by its name,
for example include "io";, to use its functions and types.
The engine's own packages are in the cTurtle API reference.
Functions and methods can fail unless marked infallible; handle a failure with
? or !! (see Errors).
| Package | Contents |
|---|---|
buffer | Growable byte storage for building, parsing, reading and writing binary data. |
files | Read and write files, and list, create and remove directories. |
io | Print text to the console, and read or write the program's standard input, output and error streams. |
json | Read JSON documents and look up their values by path (JSON Pointer, such as "/player/name"). |
math | Math on floats: square roots, powers, logarithms, trigonometry, rounding, minimum and maximum, and checks for infinity and NaN. |
process | Run other programs, read the program's command-line arguments and environment variables, and resolve and inspect paths. |
regex | Regular expressions: compile a pattern once, then find matches and their captured groups in text. |
socket | TCP network connections: connect to a server or listen for clients, then send and receive bytes. |
string | Text: the methods every string has (length, slicing, searching), and conversion between strings, numbers and buffers. |
sync | A lock for tasks that share data, so only one task changes it at a time. |
time | Clocks and timers: wait for a while, measure how much time has passed, and read the current UTC date and time. |