### Create Camera Setup Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Creates a new camera setup object. ```APIDOC ## CreateCameraSetup ### Description Creates a new camera setup object. ### Method function common.CreateCameraSetup() ### Returns - **camerasetup** - A new camera setup object. ``` -------------------------------- ### Install kak-lsp with plug.kak Source: https://github.com/luals/lua-language-server/wiki/Configuration-File This snippet shows how to install the kak-lsp plugin using plug.kak in your kakrc file. It ensures the language server is built and installed. ```vimscript plug "kak-lsp/kak-lsp" do %{ cargo install --locked --force --path . } ``` -------------------------------- ### Game Setup and Configuration Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Functions for configuring game settings such as map name, description, teams, players, start locations, and game types. ```APIDOC ## SetMapName ### Description Sets the name of the map. ### Signature `function common.SetMapName(name)` ### Parameters * `name` (string) - The desired name for the map. ``` ```APIDOC ## SetMapDescription ### Description Sets the description for the map. ### Signature `function common.SetMapDescription(description)` ### Parameters * `description` (string) - The description of the map. ``` ```APIDOC ## SetTeams ### Description Sets the number of teams in the game. ### Signature `function common.SetTeams(teamcount)` ### Parameters * `teamcount` (integer) - The number of teams. ``` ```APIDOC ## SetPlayers ### Description Sets the total number of players that can join the game. ### Signature `function common.SetPlayers(playercount)` ### Parameters * `playercount` (integer) - The maximum number of players. ``` ```APIDOC ## DefineStartLocation ### Description Defines a starting location for players using coordinates. ### Signature `function common.DefineStartLocation(whichStartLoc, x, y)` ### Parameters * `whichStartLoc` (integer) - The index for this starting location. * `x` (real) - The x-coordinate of the start location. * `y` (real) - The y-coordinate of the start location. ``` ```APIDOC ## DefineStartLocationLoc ### Description Defines a starting location for players using a location object. ### Signature `function common.DefineStartLocationLoc(whichStartLoc, whichLocation)` ### Parameters * `whichStartLoc` (integer) - The index for this starting location. * `whichLocation` (location) - The location object for the start location. ``` ```APIDOC ## SetStartLocPrioCount ### Description Sets the number of priority slots for a given starting location. ### Signature `function common.SetStartLocPrioCount(whichStartLoc, prioSlotCount)` ### Parameters * `whichStartLoc` (integer) - The index of the starting location. * `prioSlotCount` (integer) - The number of priority slots. ``` ```APIDOC ## SetStartLocPrio ### Description Sets the priority for a specific slot of a starting location. ### Signature `function common.SetStartLocPrio(whichStartLoc, prioSlotIndex, otherStartLocIndex, priority)` ### Parameters * `whichStartLoc` (integer) - The index of the starting location. * `prioSlotIndex` (integer) - The index of the priority slot. * `otherStartLocIndex` (integer) - The index of another starting location to prioritize. * `priority` (startlocprio) - The priority level. ``` ```APIDOC ## GetStartLocPrioSlot ### Description Retrieves the starting location index for a given priority slot. ### Signature `function common.GetStartLocPrioSlot(whichStartLoc, prioSlotIndex)` ### Parameters * `whichStartLoc` (integer) - The index of the starting location. * `prioSlotIndex` (integer) - The index of the priority slot. ### Returns * `integer` - The starting location index. ``` ```APIDOC ## GetStartLocPrio ### Description Retrieves the priority setting for a specific priority slot of a starting location. ### Signature `function common.GetStartLocPrio(whichStartLoc, prioSlotIndex)` ### Parameters * `whichStartLoc` (integer) - The index of the starting location. * `prioSlotIndex` (integer) - The index of the priority slot. ### Returns * `startlocprio` - The priority setting. ``` ```APIDOC ## SetEnemyStartLocPrioCount ### Description Sets the number of priority slots for enemy starting locations. ### Signature `function common.SetEnemyStartLocPrioCount(whichStartLoc, prioSlotCount)` ### Parameters * `whichStartLoc` (integer) - The index of the starting location. * `prioSlotCount` (integer) - The number of priority slots. ``` ```APIDOC ## SetEnemyStartLocPrio ### Description Sets the priority for a specific slot of an enemy starting location. ### Signature `function common.SetEnemyStartLocPrio(whichStartLoc, prioSlotIndex, otherStartLocIndex, priority)` ### Parameters * `whichStartLoc` (integer) - The index of the starting location. * `prioSlotIndex` (integer) - The index of the priority slot. * `otherStartLocIndex` (integer) - The index of another starting location to prioritize. * `priority` (startlocprio) - The priority level. ``` ```APIDOC ## SetGameTypeSupported ### Description Specifies whether a particular game type is supported. ### Signature `function common.SetGameTypeSupported(whichGameType, value)` ### Parameters * `whichGameType` (gametype) - The game type to configure. * `value` (boolean) - True if supported, false otherwise. ``` ```APIDOC ## SetMapFlag ### Description Sets a specific map flag to a boolean value. ### Signature `function common.SetMapFlag(whichMapFlag, value)` ### Parameters * `whichMapFlag` (mapflag) - The map flag to set. * `value` (boolean) - The boolean value to set the flag to. ``` ```APIDOC ## SetGamePlacement ### Description Sets the game placement type. ### Signature `function common.SetGamePlacement(whichPlacementType)` ### Parameters * `whichPlacementType` (placement) - The type of game placement. ``` ```APIDOC ## SetGameSpeed ### Description Sets the speed of the game. ### Signature `function common.SetGameSpeed(whichspeed)` ### Parameters * `whichspeed` (gamespeed) - The desired game speed. ``` ```APIDOC ## SetGameDifficulty ### Description Sets the difficulty level for the game. ### Signature `function common.SetGameDifficulty(whichdifficulty)` ### Parameters * `whichdifficulty` (gamedifficulty) - The desired game difficulty. ``` ```APIDOC ## SetResourceDensity ### Description Sets the density of resources on the map. ### Signature `function common.SetResourceDensity(whichdensity)` ### Parameters * `whichdensity` (mapdensity) - The desired resource density. ``` ```APIDOC ## SetCreatureDensity ### Description Sets the density of creatures on the map. ### Signature `function common.SetCreatureDensity(whichdensity)` ### Parameters * `whichdensity` (mapdensity) - The desired creature density. ``` ```APIDOC ## GetTeams ### Description Retrieves the current number of teams configured for the game. ### Signature `function common.GetTeams()` ### Returns * `integer` - The number of teams. ``` ```APIDOC ## GetPlayers ### Description Retrieves the total number of players allowed in the game. ### Signature `function common.GetPlayers()` ### Returns * `integer` - The maximum number of players. ``` ```APIDOC ## IsGameTypeSupported ### Description Checks if a specific game type is supported. ### Signature `function common.IsGameTypeSupported(whichGameType)` ### Parameters * `whichGameType` (gametype) - The game type to check. ### Returns * `boolean` - True if the game type is supported, false otherwise. ``` ```APIDOC ## GetGameTypeSelected ### Description Retrieves the currently selected game type. ### Signature `function common.GetGameTypeSelected()` ### Returns * `gametype` - The selected game type. ``` ```APIDOC ## IsMapFlagSet ### Description Checks if a specific map flag is currently set. ### Signature `function common.IsMapFlagSet(whichMapFlag)` ### Parameters * `whichMapFlag` (mapflag) - The map flag to check. ### Returns * `boolean` - True if the flag is set, false otherwise. ``` ```APIDOC ## GetGamePlacement ### Description Retrieves the current game placement type. ### Signature `function common.GetGamePlacement()` ### Returns * `placement` - The current game placement type. ``` ```APIDOC ## GetGameSpeed ### Description Retrieves the current speed setting of the game. ### Signature `function common.GetGameSpeed()` ### Returns * `gamespeed` - The current game speed. ``` ```APIDOC ## GetGameDifficulty ### Description Retrieves the current difficulty level of the game. ### Signature `function common.GetGameDifficulty()` ### Returns * `gamedifficulty` - The current game difficulty. ``` ```APIDOC ## GetResourceDensity ### Description Retrieves the current resource density setting for the map. ### Signature `function common.GetResourceDensity()` ### Returns * `mapdensity` - The current resource density. ``` ```APIDOC ## GetCreatureDensity ### Description Retrieves the current creature density setting for the map. ### Signature `function common.GetCreatureDensity()` ### Returns * `mapdensity` - The current creature density. ``` ```APIDOC ## GetStartLocationX ### Description Retrieves the x-coordinate of a specified starting location. ### Signature `function common.GetStartLocationX(whichStartLocation)` ### Parameters * `whichStartLocation` (integer) - The index of the starting location. ### Returns * `real` - The x-coordinate. ``` ```APIDOC ## GetStartLocationY ### Description Retrieves the y-coordinate of a specified starting location. ### Signature `function common.GetStartLocationY(whichStartLocation)` ### Parameters * `whichStartLocation` (integer) - The index of the starting location. ### Returns * `real` - The y-coordinate. ``` ```APIDOC ## GetStartLocationLoc ### Description Retrieves the location object for a specified starting location. ### Signature `function common.GetStartLocationLoc(whichStartLocation)` ### Parameters * `whichStartLocation` (integer) - The index of the starting location. ### Returns * `location` - The location object. ``` ```APIDOC ## SetPlayerTeam ### Description Assigns a player to a specific team. ### Signature `function common.SetPlayerTeam(whichPlayer, whichTeam)` ### Parameters * `whichPlayer` (player) - The player to assign. * `whichTeam` (integer) - The team index to assign the player to. ``` ```APIDOC ## SetPlayerStartLocation ### Description Assigns a player to a specific starting location index. ### Signature `function common.SetPlayerStartLocation(whichPlayer, startLocIndex)` ### Parameters * `whichPlayer` (player) - The player to assign. * `startLocIndex` (integer) - The index of the starting location. ``` ```APIDOC ## SetPlayerStartLocation ### Description Forces a player to have the specified start location and marks the start location as occupied, removing it from consideration for subsequently placed players. This can be used to fix player start locations and then use random placement for any unplaced players. ### Signature `function common.SetPlayerStartLocation(whichPlayer, startLocIndex)` ### Parameters * `whichPlayer` (player) - The player to assign. * `startLocIndex` (integer) - The index of the starting location. ``` -------------------------------- ### Create Camera Setup Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Initializes a new camera setup object. This object can be configured with various camera properties before being applied. ```jass function common.CreateCameraSetup() end ``` -------------------------------- ### Camera Setup Apply Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Applies a camera setup, optionally panning and using a timed duration. ```APIDOC ## CameraSetupApply ### Description Applies a camera setup, optionally panning and using a timed duration. ### Method function common.CameraSetupApply(whichSetup, doPan, panTimed) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup to apply. - **doPan** (boolean) - Whether to pan to the destination. - **panTimed** (boolean) - Whether the pan should be timed. ``` -------------------------------- ### Camera Setup Get Field Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the value of a specific field from a camera setup object. ```APIDOC ## CameraSetupGetField ### Description Retrieves the value of a specific field from a camera setup object. ### Method function common.CameraSetupGetField(whichSetup, whichField) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup object to query. - **whichField** (camerafield) - The camera field to retrieve. ### Returns - **real** - The value of the specified camera field. ``` -------------------------------- ### Lua Skill Configuration Example Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt A configuration block for a skill with ID 10000, detailing various effects, conditions, and properties like target filtering and animation changes. This snippet shows a typical skill setup. ```lua ["TargetFilter"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` ```lua ["IsCanMove"] = { 0, }, ``` ```lua ["IsLoop"] = { 0, }, ``` ```lua ["IsNotFuse"] = true, ``` ```lua ["Job"] = "xxx", ``` ```lua ["SkillId"] = 10000, ``` ```lua ["SkillTriggerType"] = 1, ``` ```lua ["SkillType"] = 1, ``` ```lua ["TargetCampType"] = 1, ``` -------------------------------- ### Camera Setup Apply With Z Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Applies a camera setup with a Z-axis destination offset. ```APIDOC ## CameraSetupApplyWithZ ### Description Applies a camera setup with a Z-axis destination offset. ### Method function common.CameraSetupApplyWithZ(whichSetup, zDestOffset) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup to apply. - **zDestOffset** (real) - The Z offset for the destination. ``` -------------------------------- ### Example OnSetText Plugin Implementation Source: https://github.com/luals/lua-language-server/wiki/Plugins An example implementation of the OnSetText function. It processes the input text, identifies specific patterns, and returns a list of diff objects to modify the file content. ```lua function OnSetText(uri, text) if text:sub(1, 4) ~= '--##' then return nil end local diffs = {} diffs[#diffs+1] = { start = 1, finish = 4, text = '', } for localPos, colonPos, typeName, finish in text:gmatch '()local%s+[%w_]+()%s*%:%s*([%w_]+)()' do diffs[#diffs+1] = { start = localPos, finish = localPos - 1, text = ('---@type %s\n'):format(typeName), } diffs[#diffs+1] = { start = colonPos, finish = finish - 1, text = '', } end return diffs end ``` -------------------------------- ### Example Bundled Library Path in VS Code Settings Source: https://github.com/luals/lua-language-server/wiki/Libraries An example of how a bundled library path might appear in VS Code settings after being managed by an extension. Note that this path persists even after the extension is uninstalled. ```json "Lua.workspace.library": [ "c:\\Users\\UserName\\.vscode\\extensions\\publisher.name-0.0.2\\EmmyLua" ], ``` -------------------------------- ### Example of Special Runtime Configuration Source: https://github.com/luals/lua-language-server/blob/master/doc/pt-br/config.md Configures custom global variables to be treated as special built-in variables, providing enhanced support. This example treats 'include' as 'require'. ```json { "include" : "require" } ``` -------------------------------- ### Get Lua Language Server Version Source: https://github.com/luals/lua-language-server/wiki/Getting-Started Use the --version flag to display the installed version of the Lua Language Server. The process will exit immediately after printing the version. ```bash --version ``` -------------------------------- ### Camera Setup Apply Force Duration Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Applies a camera setup, optionally panning, and forcing a specific duration. ```APIDOC ## CameraSetupApplyForceDuration ### Description Applies a camera setup, optionally panning, and forcing a specific duration. ### Method function common.CameraSetupApplyForceDuration(whichSetup, doPan, forceDuration) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup to apply. - **doPan** (boolean) - Whether to pan to the destination. - **forceDuration** (real) - The forced duration in seconds for the application. ``` -------------------------------- ### PVP Skill Configuration Example Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt Provides a configuration block for a PVP skill, including various effects and properties like hit effects, interrupt handling, and target filtering. This is a comprehensive example for defining player-versus-player skills. ```lua ["PVPHitSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["范围受击"](Attacker, Hitter, SkillInfo, HitInfo, 800) SkillFuncs["加buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker,100003) end, ["PVPInterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["PVPIsCanMove"] = { 0, }, ["PVPIsLoop"] = { 0, }, ["PVPIsNotFuse"] = true, ["PVPSkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ``` -------------------------------- ### Apply Camera Setup with Forced Duration Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Applies a camera setup, forcing a specific duration for the transition, with an option to enable panning. Useful for consistent transition timings. ```jass function common.CameraSetupApplyForceDuration(whichSetup,doPan,forceDuration) end ``` -------------------------------- ### Lua Skill Configuration Example Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt Example of a skill configuration table in Lua, including a SkillId, trigger type, and various effect functions. This structure is used to define individual skills. ```lua ["Job"] = "xxx", ``` ```lua ["SkillId"] = 10000, ``` ```lua ["CDPos"] = 1, ``` ```lua ["ChangeAnim"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` ```lua ["ComsumeEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` -------------------------------- ### Define Level Experience Configurations Descriptor Source: https://github.com/luals/lua-language-server/blob/master/test/example/largeGlobal.txt Defines the protobuf descriptor for a collection of level experience configurations, including a field for items. This allows for managing multiple level progression setups. ```lua LEVEL_EXP_CFGS = protobuf.Descriptor(); LEVEL_EXP_CFGS_ITEMS_FIELD = protobuf.FieldDescriptor(); ``` -------------------------------- ### Get Camera Setup Destination Position Y Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the destination Y-coordinate of a camera setup object. Use this to get the specific vertical target position. ```jass function common.CameraSetupGetDestPositionY(whichSetup) end ``` -------------------------------- ### Addon Directory Structure Example Source: https://github.com/luals/lua-language-server/wiki/Addons Illustrates a typical directory structure for addons, including library files and configuration. ```bash 📂 LuaAddons/ ├── 📂 Addon1/ │ ├── 📁 library/ │ ├── 📜 config.json │ └── 📜 plugin.lua └── 📂 Addon2/ ├── 📁 library/ └── 📜 config.json ``` -------------------------------- ### Get Camera Setup Destination Position X Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the destination X-coordinate of a camera setup object. Use this to get the specific horizontal target position. ```jass function common.CameraSetupGetDestPositionX(whichSetup) end ``` -------------------------------- ### Camera Setup Get Destination Position Y Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the destination Y coordinate of a camera setup. ```APIDOC ## CameraSetupGetDestPositionY ### Description Retrieves the destination Y coordinate of a camera setup. ### Method function common.CameraSetupGetDestPositionY(whichSetup) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup object. ### Returns - **real** - The destination Y coordinate. ``` -------------------------------- ### Initialize VM Environment Source: https://github.com/luals/lua-language-server/blob/master/test/example/vm.txt Sets up the initial environment for the Lua VM, including handling special variables like _ENV and ..., and configuring global variables from a provided library. It also manages read-only properties for global scope. ```lua self.results.main = self.chunk.func -- 隐藏的上值`_ENV` local parent = self:createLocal('_ENV') parent.hide = true local envValue = self:setValue(parent, self:buildTable()) -- _ENV 有个特殊标记 envValue.ENV = true -- 隐藏的参数`...` self:createDots(1) -- 设置全局变量 if not GlobalChild then for name, lib in pairs(library.global) do local field = self:createField(envValue, name) local value = self:getLibValue(lib, 'global') value = self:setValue(field, value) end GlobalChild = envValue.child end envValue.child = readOnly(GlobalChild) -- 设置 _G 使用 _ENV 的child local g = self:getField(envValue, '_G') local gValue = self:getValue(g) gValue.child = envValue.child self.env = envValue ``` -------------------------------- ### Camera Setup Get Destination Position Location Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the destination location of a camera setup. ```APIDOC ## CameraSetupGetDestPositionLoc ### Description Retrieves the destination location of a camera setup. ### Method function common.CameraSetupGetDestPositionLoc(whichSetup) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup object. ### Returns - **location** - The destination location. ``` -------------------------------- ### Camera Setup Get Destination Position X Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the destination X coordinate of a camera setup. ```APIDOC ## CameraSetupGetDestPositionX ### Description Retrieves the destination X coordinate of a camera setup. ### Method function common.CameraSetupGetDestPositionX(whichSetup) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup object. ### Returns - **real** - The destination X coordinate. ``` -------------------------------- ### Create Wrapper Script for Command Line Source: https://github.com/luals/lua-language-server/wiki/Getting-Started When the binary is not in a standard PATH directory, create a wrapper script to execute the Lua language server. ```bash #!/bin/bash exec "/bin/lua-language-server" "$@" ``` -------------------------------- ### Get Camera Setup Field Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the value of a specific camera field from a camera setup object. Useful for inspecting or reusing camera settings. ```jass function common.CameraSetupGetField(whichSetup,whichField) end ``` -------------------------------- ### Initialize kak-lsp standalone Source: https://github.com/luals/lua-language-server/wiki/Configuration-File This command initializes kak-lsp when running standalone. Ensure the kak-lsp binary is in your PATH. ```vimscript evaluate-commands %sh{ kak-lsp --kakoune -s $kak_session } ``` -------------------------------- ### Get Camera Setup Destination Position (Location) Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Retrieves the destination location (X, Y) of a camera setup object. Returns a location object representing the target coordinates. ```jass function common.CameraSetupGetDestPositionLoc(whichSetup) end ``` -------------------------------- ### Get Line Range by Row Source: https://github.com/luals/lua-language-server/blob/master/test/example/guide.txt Returns the start and finish byte offsets for a given line number. Can optionally exclude the newline character from the range. ```lua function m.lineRange(lines, row, ignoreNL) local line = lines[row] if not line then return 0, 0 end if ignoreNL then return line.start, line.range else return line.start, line.finish end end ``` -------------------------------- ### Set Documentation Output Path Source: https://github.com/luals/lua-language-server/wiki/Getting-Started Use the --doc flag to specify the directory for generating documentation files. ```bash --doc=C:/Users/Me/Documents/LuaDocuments ``` -------------------------------- ### Install libstdc++ on Fedora Source: https://github.com/luals/lua-language-server/wiki/Getting-Started This command installs the necessary libstdc++ package on Fedora-based Linux systems to resolve common compile errors during installation. ```bash dnf install libstdc++-static ``` -------------------------------- ### Run Lua Language Server on Windows Source: https://github.com/luals/lua-language-server/wiki/Getting-Started Execute the compiled Lua language server binary on Windows. ```bash .\bin\lua-language-server.exe ``` -------------------------------- ### Apply Camera Setup with Z Offset Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Applies a camera setup, specifying a Z-axis destination offset. This allows for applying camera setups with precise height control. ```jass function common.CameraSetupApplyWithZ(whichSetup,zDestOffset) end ``` -------------------------------- ### Turn On Computer Source: https://github.com/luals/lua-language-server/wiki/Export-Documentation Powers on the computer peripheral. ```lua function Computer.turnOn() ``` -------------------------------- ### Build Lua Language Server on Windows Source: https://github.com/luals/lua-language-server/wiki/Getting-Started Build the Lua language server from source on Windows using the provided batch script. ```bash .\make.bat ``` -------------------------------- ### Compile AST to VM Code Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/1.txt Initializes the virtual machine for compiling an Abstract Syntax Tree (AST) into VM code. It sets up the scope, chunk, and results structures. ```lua local function compile(ast, lsp, uri) local vm = setmetatable({ scope = env { locals = {}, }, chunk = env { labels = {}, }, results = { locals = {}, labels = {}, funcs = {}, calls = {}, sources= {}, strings= {}, ``` -------------------------------- ### Configure Camera Setup Field Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Sets a specific camera field property on a given camera setup object over a duration. This allows for fine-tuning camera behavior within a setup. ```jass function common.CameraSetupSetField(whichSetup,whichField,value,duration) end ``` -------------------------------- ### Lua Control Flow: Loops and Goto Source: https://github.com/luals/lua-language-server/blob/master/test/cli/visualize/testdata/all-types.txt Illustrates nested for loops, ipairs iteration, and the use of goto for control flow. ```lua for j = 10, 1, -1 do for i in ipairs(s) do goto foolabel ::foolabel:: end end ``` -------------------------------- ### Camera Setup Set Destination Position Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Sets the destination position for a camera setup. ```APIDOC ## CameraSetupSetDestPosition ### Description Sets the destination position for a camera setup. ### Method function common.CameraSetupSetDestPosition(whichSetup, x, y, duration) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup object. - **x** (real) - The target X coordinate. - **y** (real) - The target Y coordinate. - **duration** (real) - The time in seconds over which to move to the position. ``` -------------------------------- ### Addon Directory Structure Source: https://github.com/luals/lua-language-server/wiki/Addons Illustrates the standard directory layout for a Lua Language Server addon. ```bash 📂 myAddon/ ├── 📁 library/ │ ├── 📜 http.lua │ └── 📜 error.lua ├── 📜 plugin.lua └── 📜 config.json ``` -------------------------------- ### Camera Setup Set Field Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Sets a specific field of a camera setup object. ```APIDOC ## CameraSetupSetField ### Description Sets a specific field of a camera setup object. ### Method function common.CameraSetupSetField(whichSetup, whichField, value, duration) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup object to modify. - **whichField** (camerafield) - The camera field to set. - **value** (real) - The new value for the camera field. - **duration** (real) - The time in seconds over which the change should occur. ``` -------------------------------- ### Skill Configuration Example Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt A configuration block for a general skill, detailing its effects, properties, and conditions. This includes hit effects, interrupt handling, and target filtering for non-PVP scenarios. ```lua ["HitSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["范围受击"](Attacker, Hitter, SkillInfo, HitInfo, 2000) SkillFuncs["加buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker,100003) end, ["InitEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["InterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["IsCanMove"] = { 0, }, ["IsLoop"] = { 0, }, ["IsNotFuse"] = true, ["Job"] = "xxx", ["PVPAttackSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPCDEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPCastCondition"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPChangeAnim"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPComsumeEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPDefenseSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPHitSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["范围受击"](Attacker, Hitter, SkillInfo, HitInfo, 800) SkillFuncs["加buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker,100003) end, ["PVPInterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["PVPIsCanMove"] = { 0, }, ["PVPIsLoop"] = { 0, }, ["PVPIsNotFuse"] = true, ["PVPSkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["SkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["SkillId"] = 10000, ["SkillTriggerType"] = 1, ["SkillType"] = 1, ["TargetCampType"] = 1, ["TargetFilter"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` -------------------------------- ### Skill Configuration Example Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt A configuration block for a skill, including various effects and properties like ID, trigger type, and target filter. ```lua ["SkillId"] = 10000, ["SkillTriggerType"] = 1, ["SkillType"] = 1, ["TargetCampType"] = 1, ["TargetFilter"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` -------------------------------- ### Set Cinematic Filter Start Color Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Sets the starting color (RGBA) for a cinematic filter. ```APIDOC ## SetCineFilterStartColor ### Description Sets the starting color (RGBA) for a cinematic filter. ### Method function common.SetCineFilterStartColor(red, green, blue, alpha) ### Parameters #### Path Parameters - **red** (integer) - The red component (0-255). - **green** (integer) - The green component (0-255). - **blue** (integer) - The blue component (0-255). - **alpha** (integer) - The alpha component (0-255). ``` -------------------------------- ### Set Cinematic Filter Start UV Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Sets the starting UV coordinates for a cinematic filter. ```APIDOC ## SetCineFilterStartUV ### Description Sets the starting UV coordinates for a cinematic filter. ### Method function common.SetCineFilterStartUV(minu, minv, maxu, maxv) ### Parameters #### Path Parameters - **minu** (real) - The minimum U coordinate. - **minv** (real) - The minimum V coordinate. - **maxu** (real) - The maximum U coordinate. - **maxv** (real) - The maximum V coordinate. ``` -------------------------------- ### Lua Skill Initialization and Effects Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt Sets up initial effects, cooldowns, and conditions for a skill, including PVP-specific configurations. ```lua ["CDEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["CDPos"] = 1, ["CastCondition"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["ChangeAnim"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["ComsumeEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["DefenseSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["InitEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["InterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["IsCanMove"] = { 0, }, ["IsLoop"] = { 0, }, ["IsNotFuse"] = true, ["Job"] = "xxx", ``` -------------------------------- ### Setup Lua Language Server in Neovim Source: https://github.com/luals/lua-language-server/wiki/Configuration-File Use this snippet to set up the Lua Language Server with Neovim's built-in LSP client. Adjust the settings table to match your project's requirements. ```lua require'lspconfig'.sumneko_lua.setup { settings = { -- Settings go here! } } ``` -------------------------------- ### Camera Setup Apply Force Duration With Z Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Applies a camera setup with a Z-axis destination offset, forcing a specific duration. ```APIDOC ## CameraSetupApplyForceDurationWithZ ### Description Applies a camera setup with a Z-axis destination offset, forcing a specific duration. ### Method function common.CameraSetupApplyForceDurationWithZ(whichSetup, zDestOffset, forceDuration) ### Parameters #### Path Parameters - **whichSetup** (camerasetup) - The camera setup to apply. - **zDestOffset** (real) - The Z offset for the destination. - **forceDuration** (real) - The forced duration in seconds for the application. ``` -------------------------------- ### Inspect Client Initialization Log for rootUri Source: https://github.com/luals/lua-language-server/wiki/FAQ Examine the server log for 'Client init' messages to find the `rootUri` and other client initialization details. This helps in diagnosing issues related to project root identification. ```lua [17:58:27.365][debug][#0:script\provider\client.lua:32]: Client init { capabilities = {... }, clientInfo = { name = "Visual Studio Code - Insiders", version = "1.55.0-insider", }, locale = "zh-cn", processId = 21048, rootPath = "c:\\Users\\sumneko\\.vscode-insiders\\extensions\\vscode-lua", rootUri = "file:///c%3A/Users/sumneko/.vscode-insiders/extensions/vscode-lua", trace = "off", workDoneToken = "a9e94178-eb6f-4277-ab21-6d81a5871041", workspaceFolders = { [1] = { name = "vscode-lua", uri = "file:///c%3A/Users/sumneko/.vscode-insiders/extensions/vscode-lua", }, }, } ``` -------------------------------- ### Lua Skill Configuration Example Source: https://github.com/luals/lua-language-server/blob/master/test/parser_test/perform/4.txt Defines various skill properties and associated Lua functions for handling effects and conditions. Includes specific configurations for PVP. ```lua ["PVPInterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["PVPIsCanMove"] = { 0, }, ["PVPIsLoop"] = { 0, }, ["PVPIsNotFuse"] = true, ["PVPSkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["SkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["SkillId"] = 10000, ["SkillTriggerType"] = 1, ["SkillType"] = 1, ["TargetCampType"] = 1, ["TargetFilter"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` ```lua ["AttackSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["CDEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["CDPos"] = 1, ["CastCondition"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["ChangeAnim"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["ComsumeEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["DefenseSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["HitSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["范围受击"](Attacker, Hitter, SkillInfo, HitInfo, 2000) SkillFuncs["加buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker,100003) end, ["InitEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["InterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["IsCanMove"] = { 0, }, ["IsLoop"] = { 0, }, ["IsNotFuse"] = true, ["Job"] = "xxx", ["PVPAttackSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPCDEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPCastCondition"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPChangeAnim"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPComsumeEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPDefenseSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ["PVPHitSkillEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["范围受击"](Attacker, Hitter, SkillInfo, HitInfo, 800) SkillFuncs["加buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker,100003) end, ["PVPInterruptSkillEnd"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["PVPIsCanMove"] = { 0, }, ["PVPIsLoop"] = { 0, }, ["PVPIsNotFuse"] = true, ["PVPSkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["SkillEndEffect"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} SkillFuncs["删buff"](Attacker, Hitter, SkillInfo, HitInfo, Attacker, 100003) end, ["SkillId"] = 10000, ["SkillTriggerType"] = 1, ["SkillType"] = 1, ["TargetCampType"] = 1, ["TargetFilter"] = function(Attacker, Hitter, SkillInfo, HitInfo) local Args = {} end, ``` -------------------------------- ### Set Cinematic Filter Start Color Source: https://github.com/luals/lua-language-server/blob/master/test/example/jass-common.txt Sets the starting RGBA color for a cinematic filter. This color is applied as a tint or overlay effect. ```jass function common.SetCineFilterStartColor(red,green,blue,alpha) end ```