# System function ## Function system function is the global basic capability of BT runtime, covering environment introspection, dynamic calling, type conversion, JSON serialization, regularization, path, sleep, random number and standard library construction entry. ## API list | API | Description | | ------ | ------ | | [envs](/en/docs/system/envs) | Read system environment objects, or read system functions, standard library constructors, and system constants by name. | | [env](/en/docs/system/env) | Read the user global environment object, or read the user global variable by name. | | [has_envs](/en/docs/system/has_envs) | Determine whether the specified name exists in the system environment. | | [has_env](/en/docs/system/has_env) | Determine whether the specified variable exists in the user's global environment. | | [pause](/en/docs/system/pause) | Output an optional prompt to the console and wait for the user to press Enter. | | [assert](/en/docs/system/assert) | Assert that the condition is true and throw a runtime error when it fails. | | [echo](/en/docs/system/echo) | Convert all parameters into strings, connect them with spaces and output them to the console. | | [bool](/en/docs/system/bool) | Convert the value to a Boolean value according to BT truth rules. | | [eval](/en/docs/system/eval) | Compile and execute a string script, returning the value of the script's explicit return or exit. | | [exit](/en/docs/system/exit) | Set the exit value and end the current script execution. | | [include](/en/docs/system/include) | Introduce and execute the BT file during runtime, and return the value of the explicit return or exit of the imported file. | | [include_once](/en/docs/system/include_once) | BT files are introduced and executed during runtime. The same real file in the same execution context is only executed once. | | [cur_dir](/en/docs/system/cur_dir) | Return to the directory where the current source code file is located. | | [cur_file](/en/docs/system/cur_file) | Return the current source code file path. | | [cur_root](/en/docs/system/cur_root) | Returns the current VM project root directory. | | [type](/en/docs/system/type) | The script-visible type name of the return value. | | [call](/en/docs/system/call) | Dynamically call a function by function name or function value. | | [task](/en/docs/system/task) | Create a lightweight background task and read the status and results through await, done, result, on_done. | | [task_all](/en/docs/system/task_all) | Wait for a set of Tasks to be completed and return an array of successful results in the order of input. | | [task_race](/en/docs/system/task_race) | Wait for the first completed task in a set of Tasks and return its result. | | [set_timeout](/en/docs/system/set_timeout) | Register a one-time delay callback and return the Timer object immediately. | | [set_interval](/en/docs/system/set_interval) | Register a fixed-delay repeating callback and return a Timer object immediately. | | [Timer.cancel](/en/docs/system/timer) | Cancel a timeout or subsequent interval that has not yet been triggered. | | [number](/en/docs/system/number) | Convert the value to a number. | | [string](/en/docs/system/string) | Convert the value to a string. | | [float](/en/docs/system/float) | Convert a value to a floating point number. | | [int](/en/docs/system/int) | Convert the value to an integer. | | [array](/en/docs/system/array) | Convert a value to an array. | | [object](/en/docs/system/object) | Convert a value to an object. | | [json](/en/docs/system/json) | Serializes a value into a standard JSON string. | | [regex](/en/docs/system/regex) | Compiles a regular expression and returns a Regex object. | | [is_empty](/en/docs/system/is_empty) | Determine whether the value is empty. | | [is_null](/en/docs/system/is_null) | Determine whether the value is Null. | | [sleep](/en/docs/system/sleep) | Let the current thread sleep for the specified number of milliseconds. | | [rand](/en/docs/system/rand) | Generate pseudo-random numbers. | ## Examples ```bt result = type(json({name: 'BT'})) // Output: String print result ``` ## Notes - System functions are stateless; object standard library entries such as fs, html, crypto, url, path, bytes, mysql, modbus, reqwest are created by the library construction branch of the VM. - `print` and `println` are language output statements and are not system functions dynamically callable through `call()`; their usage is described in [Output ](/en/docs/output). - `echo` is a system function that supports `echo(value)` and single-argument parentheses-free syntax.