diff --git a/docs/globals/index.md b/docs/globals/index.md new file mode 100644 index 0000000..97b5866 --- /dev/null +++ b/docs/globals/index.md @@ -0,0 +1,68 @@ +--- +title: Globals +description: Built-in globals. +weight: 1 +--- + +Globals are automatically available in every script and do not need to be referenced from another object. + +## Methods + +This section documents built-in non-standard functions. + +--- + +### spawn(callback;function) { method } + +Executes a function asynchronously in a new thread. + +**Example** + +```lua +spawn(function() + print("Hello, world!") +end) +``` + +### tick(void):number { method } + +Returns how much time has passed in seconds since the Unix epoch. + +### wait(seconds;number):number { method } + +Yields the current thread for a duration. +Returns the time waited. + +**Example** + +```lua +print("foo") +wait(1) +print("bar") +``` + +