Glossary
Data types
Types that are not data types on their own, but collections of types for the purpose of documentation.
Enumerable
An enumerable is any type that has a series of sub-elements, and can be indexed.
The current types that belong to the enumerable category are:
Elements
Different enumerables have different elements over which you can iterate.
If a proc is called with element of multiple values, each value is passed as a separate argument.
For strings, each element is a string containing this next character of the string.
For arrays, each element is just the next value in the array.
For objects, there are two values per element: A string of the key, and the value of the next key-value pair.
Character
A character is a string with only one character.
If a function takes a character as a parameter, it uses the first character of the string given.
Sizeable
Any data type that has a well defined size.
Properties
Properties of a certain value, which are used internally.
Size
The numeric quantity of a value.
The size of undefined is 0
.
The size of a boolean is 1
, if true, 0
if false.
The size of an integer is its value.
The size of a string is its length.
The size of an array is its length.
The size of an object is the number of keys.
Truthiness
A value is truthy if its size is not zero.
A resource is always truthy.
Undefined is always falsey (not truthy).
Scope
A scope begins when you enter a block, and ends when you leave it.
When a block is left, variables defined in that scope are removed.
Variables defined before a block is entered are also accessible in that block.
There is also a global scope, which is accessible everywhere in the program.
Variables defined in the global scope last the entire program.
Runtime
A runtime is a datapack that implements a user interface with GolemScript, allowing you to run programs more easily, and without using the GolemScript API.
Extension
An extension is a datapack that uses the GolemScript API to add new language features, without imeplementing a full user interface. Extensions are used in conjunction with a runtime.