lia

Top-level library containing all Lilia libraries.

A large majority of the framework is split into respective libraries that reside within lia.

Functions

include(fileName, state)

Loads a Lua file into the server, client, or shared realm. This function includes a Lua file into the server, client, or shared realm depending on the specified state. This function has an legacy alias lia.util.include that can be used instead of lia.include.

Parameters

  • fileName String

    The name of the Lua file to be included.

  • state String

    The state in which the Lua file should be included: "server", "client", or "shared".

Returns

  • any

    If the Lua file is included on the server and the state is "server", it returns the included file; otherwise, no return value.

includeDir(directory, fromLua, recursive, realm)

Loads Lua files from a directory into the server, client, or shared realm. This function recursively includes Lua files from a directory into the specified realm. This function has a legacy alias lia.util.includeDir that can be used instead of lia.includeDir.

Parameters

  • directory String

    The directory containing the Lua files to be included.

  • fromLua Boolean

    Specifies if the Lua files are located in the lua/ folder.

  • recursive Boolean

    Specifies if subdirectories should be included recursively.

  • realm String

    string The realm in which the Lua files should be included: "server", "client", or "shared".

includeEntities(path)

Dynamically loads Lua files for entities, weapons, tools, and effects into the appropriate realm of a Garry's Mod Lua project. This function iterates through a specified directory and its subdirectories, including Lua files for entities, weapons, tools, and effects into the server, client, or shared realm as needed. The function automatically registers the entities, weapons, tools, and effects in the correct context (server, client, or shared). A legacy alias lia.util.loadEntities is available, which can be used instead of lia.includeEntities.

Parameters

  • path String

    The directory containing the Lua files to be included.