Global Functions and Types¶
In Lemonate, most classes and functions must be explicitly imported before use, typically using Lua’s require mechanism. For example:
local Vector3 = require 'engine/math/vector3'
This modular approach keeps the global namespace clean and helps avoid naming conflicts, which is particularly important in large codebases or user-generated content scenarios. However, a small set of core types and functions are made available globally by default, without needing to import them.
These globally available elements are fundamental to engine scripting and are frequently used in almost all scripts. Making them global improves ergonomics and reduces repetitive boilerplate, especially for users new to the engine.
The following table lists all global functions and types provided by Lemonate.
Name |
Type |
Description |
---|---|---|
|
Type |
Base class used for defining custom class types. Supports inheritance and metaclass behavior. |
|
Type |
The base type for all scripts. Used to provides basic functionality for scripts like adding properties |
|
Type |
An asynchronous task abstraction used for chaining operations, similar to JavaScript Promises. |
|
Type |
Defines reactive fields on entities that automatically synchronize with the UI |
|
Type |
Provides logging utilities and access to the developer console. Useful for debugging and diagnostics. |
|
Function |
Serializes a Lua value (including tables) in a readable format and returns as string. Mainly for debugging. |
|
Function |
Like |
|
Function |
Imports and returns a module, similar to |
|
Function |
Waits for a Promise to resolve. Used to pause execution in asynchronous code blocks |