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

Class

Type

Base class used for defining custom class types. Supports inheritance and metaclass behavior.

Entity

Type

The base type for all scripts. Used to provides basic functionality for scripts like adding properties

Promise

Type

An asynchronous task abstraction used for chaining operations, similar to JavaScript Promises.

Property

Type

Defines reactive fields on entities that automatically synchronize with the UI

Console

Type

Provides logging utilities and access to the developer console. Useful for debugging and diagnostics.

dump

Function

Serializes a Lua value (including tables) in a readable format and returns as string. Mainly for debugging.

printDump

Function

Like dump, but prints the result to the console directly.

import

Function

Imports and returns a module, similar to require, but used to load a user scripts by a relative path

await

Function

Waits for a Promise to resolve. Used to pause execution in asynchronous code blocks