MiliLua API Definitions is a VS Code extension that provides IntelliSense and extended tooling for the Miliastra Wonderland Lua API based on definitions and documentation from the miliastra-lua-api repo.
See Privacy and Additional Notes for info on how your data is handled by this extension.
- Complete definitions for all types, fields, functions, globals, and enums.
- Additional aliases and classes to provide additional typing and IntelliSense:
TweenTarget, containing all tweenable Client Control fields.Vector3, to represent the 3D Vector data type.ApiType, containing all known return values from thetypeoffunction.
- Extended documentation verified through testing.
- Miliastra Save Explorer for quickly opening workspaces for stage saves.
- Resource Extraction for enhanced autocomplete and typing.
- Snippets for commonly used blocks of code.
Get the extension from the Visual Studio Code Marketplace.
-
Open the Miliastra Toolkit menu in the Activity Bar, then select the save that you want to open in the Save Explorer.
-
Select "Yes" when prompted to enable MiliLua for the current workspace.
-
Open the Miliastra editor for the corresponding project, then save the project in the Miliastra editor. A folder called
.gil_resourcesshould be generated.
-
Open your project's save folder in VS Code.
File > Open Folder > vvv Navigate to Save Path vvv C:\Users\YOUR_USER\AppData\LocalLow\miHoYo\Genshin Impact\BeyondLocal\YOUR_UID\Beyond_Local_Save_Level\YOUR_SAVE_IDThis folder should contain the
.gilfile andexternal_lua_filefolder for your project. -
Select "Yes" when prompted whether to enable MiliLua for the current workspace.
-
Open the Miliastra editor for the corresponding project, then save the project in the Miliastra editor. A folder called
.gil_resourcesshould be generated.
Hover over the "Miliastra" status bar entry to diagnose common issues. Click the suggested link to resolve issues.
| Setting | Type | Description |
|---|---|---|
mililua.enableDefinitions |
boolean |
(Workspace only) Whether to enable Miliastra Wonderland Lua API support for the current workspace. |
mililua.extractGilResources |
boolean |
(Workspace only) Whether to attempt resource extraction from the .gil file matching the current workspace folder name. |
The Miliastra Toolkit is a view added to the activity bar, enabling quick access to saves on the local device.
The Save Explorer is the primary view displayed in the Miliastra Toolkit, allowing you to quickly open saves on your device. Clicking a stage entry will automatically open that save in VS Code. Use the refresh button to update the listed stages.
When the "Extract Gil Resources" setting is enabled for your current workspace, the extension will automatically attempt to extract resources from the .gil file matching the workspace folder name whenever a save occurs in the Miliastra editor. Extracted resources are stored in the .gil_resources directory.
| Extracted Resource | Description |
|---|---|
| Client Controls | The index of all Client Control Templates will be extracted to provide autocomplete for the game.InstantiateClientUIControl function.The name of all Client Controls in the hierarchy and saved Client Control Templates will be extracted to provide autocomplete for the game.FindClientUIRoot and ClientUIBaseControl:GetChild functions. |
| Custom Variables | The name of Custom Variables set in the Custom Variable component of the Stage Entity, Player Templates, Character Templates, Class Templates, placed entities, and prefabs will be extracted to provide autocomplete for the game:GetGlobalCustomVariableValue and Custom Variable listener related functions. |
| Script Text Variables | The Mapping ID of Script Text Variables will be extracted to provide autocomplete for the game.GetText function. |
| Script Variables | The name and type of Script Variables defined in your Script Mappings will be extracted to provide autocomplete and type-checking for the script:GetParam function. A union type will be provided in scenarios where the same variable name is used in multiple Script Mappings with different types. |
| Signals | The name and typed parameters of all Signals will be extracted to provide Signal name autocomplete for all signal-related functions, as well as type-checking for Signal parameters. |
| Prefix | Description |
|---|---|
mili-lifecycle |
Generates all lifecycle functions. |
function OnInit()OnInit |
Generates the OnInit lifecycle function. |
function OnEnable()OnEnable |
Generates the OnEnable lifecycle function. |
function OnStart()OnStart |
Generates the OnStart lifecycle function. |
function OnUpdate()OnUpdate |
Generates the OnUpdate lifecycle function. |
function OnLevelUpdate()OnLevelUpdate |
Generates the OnLevelUpdate lifecycle function. |
function OnDisable()OnDisable |
Generates the OnDisable lifecycle function. |
function OnDestroy()OnDestroy |
Generates the OnDestroy lifecycle function. |
mili-tweengame.Tween |
Generates Tween starter code. |
mili-tween-one-shot |
Generates a Tween that calls Kill when completed. |
mili-tween-sequence-one-shot |
Generates a Tween Sequence that calls Kill when completed. |
- Functions that return
ClientUIBaseControldo return the exact runtime type; however, LuaLS cannot infer the correct type, so an alias containing all Client Control types is returned instead. - Functions that return data from the server, such as from signals or
game.GetGlobalCustomVariableValue, will always return a type from theServerDataTypealias ornil; however, LuaLS cannot infer the correct type, soanyis returned instead. TweenTargetexposes all tweenable fields from all Client Control types; however, attempting to tween fields for the wrong type may cause errors at runtime.
- Unless specified below, no data, files, or analytics are sent to any third-party service.
- This extension does not modify
.gilfiles. - Genshin account names are fetched by querying the Enka.Network API using UIDs found in the
BeyondLocaldirectory. - Save names are fetched by only decoding the save name parameter in
.gilfiles found in theBeyondLocaldirectory. - Symlinks are ignored by the Save Explorer.
- Gil Resource Extraction can be disabled separately from Lua API support.
- Lua definition files in the
.gil_resourcesfolder should not be mapped in the Client Script Resource Explorer. - The
.gil_resourcesfolder can be safely excluded from a Git repo through.gitignore.
- Custom Variable typing.
- Compatibility with Shared Creation Mode saves.
- Built-in utility module management.
- Community-driven utility function contributions.



