• int - takes a value, casts it as an integer
int(value);
int("1") + int("1"); => 2
  • float - takes a value, casts it as a float
float(value);
float("1.2") + float("1.7"); => 2.9
  • str - takes a value, casts it as a string
str(value);
"The number is " + str(1) + "."; => "The number is 1."
  • throw - takes a string, throws an error with the string as the message
throw(string);
  • vargs - not a function, just a list of argument, doesn’t include prog name
vargs;
./glados --exec file.gvm -- hello world
vargs; => ["hello", "world"]
  • rand - returns a random float between 0 and 1
rand();
rand(); => 0.3787218973
  • uniform - takes two floats, returns a random float between them
uniform(min, max);
uniform(10, 100); => 49.287491278
  • randrange - takes two integers, returns a random integer between them
randrange(min, max);
randrange(10, 15); => 12
  • time - returns an epoch timestamp
time();
time(); => 1699135732
  • timeit - returns a list with the current seconds and nanoseconds
timeit();
timeit(); => [1699135732, 1283457]
  • sleep - takes a float, sleeps for that many seconds
sleep(float);
  • typeof - takes a value, returns a string with the type
typeof(value);
typeof(14); => "integer"
typeof(0.0); => "float"
typeof('h'); => "char"
typeof(True); => "boolean"
typeof("hello"); => "string"
typeof(nil); => "Nil"
typeof([]); => "list"
  • subprocess: takes a list of string, executes the program. Returns 0 on success and 1 on failure. Doesn’t support pipes, conditions.
subprocess([command, arg1, arg2, ...]);
subprocess(["true"]); => 0
subprocess(["false"]); => 1
subprocess(["echo", "Hello, world!"]); => 0 (and prints 'Hello, world!')