Refers to constants and functions that are defined during initialization of the AiScript interpreter and can be used anywhere in script.
#Core:v
A prefix #
indicates a std constant.
In this case, the name is Core:v
.
@Core:type(v: value): str
A prefix @
indicates a std function.
The example shown is a function called Core:type
,
it takes one argument of type value
(i.e., any type) named v
and returns a value of type str
(string type).
Outputs a string. (In most cases the string will be displayed on screen, but behavior is up to the host implementation.)
Accepts input of character strings.
Type: str
.
AiScript version.
Gets the type name of the value.
Gets a string representation of a value.
Waits for the specified time (milliseconds).
Generates a new UUID.
Generates JSON from a value.
Parses JSON into value.
Returns an error type value (name
='not_json'
) if given string is not parsable as JSON.
Determines if a string can be parsed as JSON. Exists for historical reasons.
Gets the current time as a number for use in the functions below. Technically, the value is the same as when you use Date.now()
in Javascript.
Gets the current value of the corresponding unit of time.
If a value obtained with Date:now()
is passed as an argument, it returns the value corresponding to that time.
If the string can be interpreted as a time, converts into the same format as Date:now()
.
For conversion, it uses the JavaScript Date constructor internally.
Type: num
.
It's pi.
Calculate the sine.
Calculate the cosine.
Calculate the absolute value.
Calculate the square root.
Get the smaller value.
Get the larger value.
Generate a random number.
Generates a hexadecimal string from a number.
Generates a numeric value from a hexadecimal string.
Type: str
.
Newline code (LF).
Returns -1 if a < b,
0 if a == b,
or 1 if a > b.
Using this as a comparison function for arr.sort
, the array is sorted in ascending lexicographic order.
Returns -1 if a > b,
0 if a == b,
or 1 if a < b.
Using this as the comparison function for arr.sort
, the array is sorted in descending lexicographic order.
Generates character from unicode code point.
codepoint must be greater than or equal to 0 and less than or equal to 10FFFFFF16.
Multiple arguments are not supported yet.
Get the length of a string.
Get the specified portion of a string.
Get the number of array elements.
Adds an element to the end of an array.
Extracts the last element of an array.
Concatenate the arrays.
Concatenates an array of strings and returns them as a single string.
Returns whether the array contains the specified value or not.
Searches for an element in an array.
Invert the array.
Generate a copy of the array.
Returns an array of object keys, values, and key/value pairs, respectively.
Gets the value corresponding to the given key of the object.
Equivalent to obj[key]
.
Sets the value corresponding to the given key of the object.
Equivalent to obj[key] = val
.
Checks if obj[key]
exists.
Generate a copy of the object.
Calls the callback function at the specified period.
Returns the stop function as a return value.
Calls the callback function after the specified time has elapsed.
Returns the stop function as a return value.