Skip to content

Engine

The Engine object that is used to run a Luwow application.


initialize

void initialize()

Initializes a new Luau state, sets the environment variables, and sandboxes the state.

Returns


require

int require(lua_State* L, const std::string& moduleName);

Requires a module with the given name. The module name can be of a Luau module, or an internal module.

If the module is a Luau module, its result after execution will be saved to the cache. Further requires will return this cached result to the Luau thread it was called from.

If the module is an internal module, its exported functions will be returned in a table to the Luau thread it was called from.

Parameters

L: lua_State* The Luau thread that the function is being called with.
moduleName: const std::string& The name of the module that will be required.

Returns

int


executeModule

int executeModule(lua_State* L, const std::string& moduleName, const std::string& bytecode);

Executes a module with its bytecode in a new sandboxed Luau thread. If the engine has a debugger callback function, it will be called with the new thread state from this function.

Parameters

L: lua_State* The Luau thread that the function is being called with.
moduleName: const std::string& The name of the Luau module that will be ran.
bytecode: const std::string& The bytecode of the Luau module.

Returns

int


run

void run()

Runs the engine. Should be called the last after initialization.

If the engine has been given a package, it will attempt to run the package contents.

If the engine has been given a Luau module with a compiler callback, it will first compile the module using the callback, and then run it.

Returns