Welcome to the CursorScript API documentation. This index provides links to detailed documentation for each library and core language feature.
- Math Library - Mathematical constants and functions.
- Game Library - Physics, collisions, and gameplay utilities.
- Window Library - Native windowing and 2D drawing.
- Network Library - Asynchronous HTTP requests.
- Thread Library - Multi-threading and background tasks.
- Crypto Library - Hashing, encryption, and UUIDs.
- JSON Library - Serializing and deserializing data.
- File Library - Filesystem read/write operations.
- Audio Library - Loading and playing sounds.
- Engine3D Library - High-performance 3D rendering.
- String Library - String manipulation utilities.
- DateTime Library - Date and time utilities.
- Server Library - HTTP and WebSocket server support.
- Database Library - SQLite and MongoDB database support.
-
Perlin Noise Library - Procedural noise generation.
- Math Library - Mathematical constants and functions.
- Game Library - Physics, collisions, and gameplay utilities.
- Window Library - Native windowing and 2D drawing.
- Network Library - Asynchronous HTTP requests.
- Thread Library - Multi-threading and background tasks.
- Crypto Library - Hashing, encryption, and UUIDs.
- JSON Library - Serializing and deserializing data.
- File Library - Filesystem read/write operations.
- Server Library - HTTP and WebSocket server support.
- Database Library - SQLite and MongoDB database support.
| Function | Description | Example |
|---|---|---|
print(args...) |
Prints values to the console. | print("Hello", 42); |
printError(...) |
Prints values to the error console (red). | printError("Fetch failed!"); |
time() |
Returns the current time in milliseconds. | let start = time(); |
rand(min, max) |
Returns a random integer between min and max (inclusive). | let n = rand(1, 10); |
len(val) |
Returns the length of a string or array. | len("hello"); // 5 |
push(arr, v) |
Appends a value to the end of an array. | push(myArr, 10); |
pop(arr) |
Removes and returns the last element of an array. | let last = pop(myArr); |
shift(arr) |
Removes and returns the first element of an array. | let first = shift(myArr); |
unshift(arr, v) |
Prepends a value to the start of an array. | unshift(myArr, 0); |
str(val) |
Converts a value to its string representation. | let s = str(123); |
typeof(val) |
Returns the type of a value as a string. | let t = typeof(10); // "number" |
concat(args...) |
Concatenates values into a single string with spaces. | concat("foo", "bar"); // "foo bar" |
exit() |
Exits the program with code 1. | exit(); |
clear() |
Clears the console. | clear(); |
help() |
Prints help information to the console. | help(); |
wait(ms) |
Asynchronously pauses execution for ms milliseconds. |
await wait(1000); |