Skip to content

Standard Libraries

Cuber01 edited this page Jul 16, 2022 · 1 revision

Standard Libraries

By default the user has access to the core library module. Further can be included by using include("moduleName").

All functions below return null unless otherwise specified.

Core

include(string)

Include another library module.

Available modules: math, os, random.

type(any)

Returns: Type of value, as string.

print(any)

Prints value on standard output.

OS

fileRead(string)

Takes path to file.

Returns: String with contents of the file.

fileWrite(string, string)

Overrides contents of a file with the new string.

First arguments specifies path to file. Second is the content to write.

fileCreate(string)

Create file at path.

fileRemove(string)

Remove file at path.

directoryCreate(string)

Create directory at path.

directoryRemove(string)

Remove directory at path. Works only if empty.

directoryExists(string)

Returns: True if directory at path exists and false if it doesn't.

fileExists(string)

Returns: True if file at path exists and false if it doesn't.

inputString(number)

Stops the program and reads text written by the user. Argument specifies the amount of chars to take.

Returns: String entered by the user.

inputYesNo()

Stops the program and reads text written by the user.

Returns: True if the text entered by the user is case insensitive yes/y, false if the text entered by the user is case insensitive no/n. Null on any other case.

exit(number)

Exits the program with the given exit code.

getDate()

Returns: Current date and hour, as a string.

Random

init()

Init pseudo random number generation with time.

bool(number)

Returns: Either true or false. The argument specifies the chance for true, it has to be between 0-1.

integer()

Returns: Random integer.

integerBetween(number, number)

First argument specifies the minimum value, second the maximum.

Returns: Random integer between min and max.

integerBetween(number, number)

First argument specifies the minimum value, second the maximum.

Returns: Random number (double) between min and max.

Math

Unless otherwise specified, see https://cplusplus.com/reference/cmath/ for function details.

abs(number)

Returns: Number.

acos(number)

Returns: Number.

asin(number)

Returns: Number.

atan(number)

Returns: Number.

atan2(number, number)

Returns: Number.

ceil(number)

Returns: Number.

floor(number)

Returns: Number.

exp(number)

Returns: Number.

mod(number)

Returns: Number.

max(number, number)

Returns: Number.

min(number, number)

Returns: Number.

sin(number)

Returns: Number.

cos(number)

Returns: Number.

tan(number)

Returns: Number.

sqrt(number)

Returns: Number.

round(number)

Returns: Number.

degreesToRadians(number)

Returns: Number of radians converted from degrees.

radiansToDegrees(number)

Returns: Number of degrees converted from radians.