diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-20 19:40:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-20 19:40:14 +0800 |
commit | 2646668ef25f8a90d07f2cc929a037e62c729381 (patch) | |
tree | 042f6c08a0b092c7148f349bdfad0f2b7b1dfb5c | |
parent | 7801b00a804bcd68aacda265afdf4d774486b4e9 (diff) | |
download | lua-language-server-2646668ef25f8a90d07f2cc929a037e62c729381.zip |
update
-rw-r--r-- | meta/3rd/love2d/library/love.audio.lua | 8 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.event.lua | 4 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.filesystem.lua | 10 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.graphics.lua | 14 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.joystick.lua | 18 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.keyboard.lua | 106 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.window.lua | 6 | ||||
-rw-r--r-- | tools/love-api.lua | 14 |
8 files changed, 94 insertions, 86 deletions
diff --git a/meta/3rd/love2d/library/love.audio.lua b/meta/3rd/love2d/library/love.audio.lua index b0ae195a..7bd8e0b4 100644 --- a/meta/3rd/love2d/library/love.audio.lua +++ b/meta/3rd/love2d/library/love.audio.lua @@ -157,7 +157,7 @@ function love.audio.setDopplerScale(scale) end --- ---@overload fun(name: string, enabled: boolean):boolean ---@param name string # The name of the effect. ----@param settings table # The settings to use for this effect, with the following fields: +---@param settings {type: EffectType, volume: number} # The settings to use for this effect, with the following fields: ---@return boolean success # Whether the effect was successfully created. function love.audio.setEffect(name, settings) end @@ -341,13 +341,13 @@ function Source:getDuration(unit) end --- ---@param name string # The name of the effect. ---@param filtersettings table # An optional empty table that will be filled with the filter settings. ----@return table filtersettings # The settings for the filter associated to this effect, or nil if the effect is not present in this Source or has no filter associated. The table has the following fields: +---@return {volume: number, highgain: number, lowgain: number} filtersettings # The settings for the filter associated to this effect, or nil if the effect is not present in this Source or has no filter associated. The table has the following fields: function Source:getEffect(name, filtersettings) end --- ---Gets the filter settings currently applied to the Source. --- ----@return table settings # The filter settings to use for this Source, or nil if the Source has no active filter. The table has the following fields: +---@return {type: FilterType, volume: number, highgain: number, lowgain: number} settings # The filter settings to use for this Source, or nil if the Source has no active filter. The table has the following fields: function Source:getFilter() end --- @@ -489,7 +489,7 @@ function Source:setEffect(name, enable) end ---Sets a low-pass, high-pass, or band-pass filter to apply when playing the Source. --- ---@overload fun() ----@param settings table # The filter settings to use for this Source, with the following fields: +---@param settings {type: FilterType, volume: number, highgain: number, lowgain: number} # The filter settings to use for this Source, with the following fields: ---@return boolean success # Whether the filter was successfully applied to the Source. function Source:setFilter(settings) end diff --git a/meta/3rd/love2d/library/love.event.lua b/meta/3rd/love2d/library/love.event.lua index f0c02d2a..10376b2e 100644 --- a/meta/3rd/love2d/library/love.event.lua +++ b/meta/3rd/love2d/library/love.event.lua @@ -197,8 +197,8 @@ function love.event.wait() end --- ---Quit --- ----@field ["q"] integer +---@field q integer --- ---Window focus gained or lost --- ----@field ["f"] integer +---@field f integer diff --git a/meta/3rd/love2d/library/love.filesystem.lua b/meta/3rd/love2d/library/love.filesystem.lua index 949d67e9..007f3675 100644 --- a/meta/3rd/love2d/library/love.filesystem.lua +++ b/meta/3rd/love2d/library/love.filesystem.lua @@ -73,7 +73,7 @@ function love.filesystem.getIdentity() end ---@overload fun(path: string, filtertype: love.FileType, info: table):table ---@param path string # The file or directory path to check. ---@param filtertype love.FileType # If supplied, this parameter causes getInfo to only return the info table if the item at the given path matches the specified file type. ----@return table info # A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields: +---@return {type: FileType, size: number, modtime: number} info # A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields: function love.filesystem.getInfo(path, filtertype) end --- @@ -448,19 +448,19 @@ function FileData:getFilename() end --- ---Open a file for read. --- ----@field ["r"] integer +---@field r integer --- ---Open a file for write. --- ----@field ["w"] integer +---@field w integer --- ---Open a file for append. --- ----@field ["a"] integer +---@field a integer --- ---Do not open a file (represents a closed file.) --- ----@field ["c"] integer +---@field c integer --- ---The type of a file. diff --git a/meta/3rd/love2d/library/love.graphics.lua b/meta/3rd/love2d/library/love.graphics.lua index 0c28d212..69cd2cdd 100644 --- a/meta/3rd/love2d/library/love.graphics.lua +++ b/meta/3rd/love2d/library/love.graphics.lua @@ -348,7 +348,7 @@ function love.graphics.getStackDepth() end ---Gets performance-related rendering statistics. --- ---@overload fun(stats: table):table ----@return table stats # A table with the following fields: +---@return {drawcalls: number, canvasswitches: number, texturememory: number, images: number, canvases: number, fonts: number, shaderswitches: number, drawcallsbatched: number} stats # A table with the following fields: function love.graphics.getStats() end --- @@ -451,7 +451,7 @@ function love.graphics.line(x1, y1, x2, y2) end ---To use an array image in a Shader, it must be declared as a ArrayImage or sampler2DArray type (instead of Image or sampler2D). The Texel(ArrayImage image, vec3 texturecoord) shader function must be used to get pixel colors from a slice of the array image. The vec3 argument contains the texture coordinate in the first two components, and the 0-based slice index in the third component. --- ---@param slices table # A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each sub-image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the slice index of that sub-table. ----@param settings table # Optional table of settings to configure the array image, containing the following fields: +---@param settings {mipmaps: boolean, linear: boolean, dpiscale: number} # Optional table of settings to configure the array image, containing the following fields: ---@return love.Image image # An Array Image object. function love.graphics.newArrayImage(slices, settings) end @@ -511,7 +511,7 @@ function love.graphics.newCanvas() end --- ---@overload fun(faces: table, settings: table):love.Image ---@param filename string # The filepath to a cubemap image file (or a File, FileData, or ImageData). ----@param settings table # Optional table of settings to configure the cubemap image, containing the following fields: +---@param settings {mipmaps: boolean, linear: boolean} # Optional table of settings to configure the cubemap image, containing the following fields: ---@return love.Image image # An cubemap Image object. function love.graphics.newCubeImage(filename, settings) end @@ -560,7 +560,7 @@ function love.graphics.newImageFont(filename, glyphs) end ---@overload fun(vertexformat: table, vertices: table, mode: love.MeshDrawMode, usage: love.SpriteBatchUsage):love.Mesh ---@overload fun(vertexformat: table, vertexcount: number, mode: love.MeshDrawMode, usage: love.SpriteBatchUsage):love.Mesh ---@overload fun(vertexcount: number, texture: love.Texture, mode: love.MeshDrawMode):love.Mesh ----@param vertices table # The table filled with vertex information tables for each vertex as follows: +---@param vertices {["1"]: number, ["2"]: number, ["3"]: number, ["4"]: number, ["5"]: number, ["6"]: number, ["7"]: number, ["8"]: number} # The table filled with vertex information tables for each vertex as follows: ---@param mode love.MeshDrawMode # How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. ---@param usage love.SpriteBatchUsage # The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. ---@return love.Mesh mesh # The new mesh. @@ -638,7 +638,7 @@ function love.graphics.newVideo(filename) end ---Array images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them. --- ---@param layers table # A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap. ----@param settings table # Optional table of settings to configure the volume image, containing the following fields: +---@param settings {mipmaps: boolean, linear: boolean} # Optional table of settings to configure the volume image, containing the following fields: ---@return love.Image image # A volume Image object. function love.graphics.newVolumeImage(layers, settings) end @@ -1281,7 +1281,7 @@ function Mesh:getVertexCount() end --- ---Gets the vertex format that the Mesh was created with. --- ----@return table format # The vertex format of the Mesh, which is a table containing tables for each vertex attribute the Mesh was created with, in the form of {attribute, ...}. +---@return {attribute: table} format # The vertex format of the Mesh, which is a table containing tables for each vertex attribute the Mesh was created with, in the form of {attribute, ...}. function Mesh:getVertexFormat() end --- @@ -1365,7 +1365,7 @@ function Mesh:setVertexMap(map) end --- ---@overload fun(data: love.Data, startvertex: number) ---@overload fun(vertices: table) ----@param vertices table # The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}. +---@param vertices {attributecomponent: number} # The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}. ---@param startvertex number # The index of the first vertex to replace. function Mesh:setVertices(vertices, startvertex) end diff --git a/meta/3rd/love2d/library/love.joystick.lua b/meta/3rd/love2d/library/love.joystick.lua index 39a5eeba..dab3ea25 100644 --- a/meta/3rd/love2d/library/love.joystick.lua +++ b/meta/3rd/love2d/library/love.joystick.lua @@ -251,19 +251,19 @@ function Joystick:setVibration(left, right) end --- ---Bottom face button (A). --- ----@field ["a"] integer +---@field a integer --- ---Right face button (B). --- ----@field ["b"] integer +---@field b integer --- ---Left face button (X). --- ----@field ["x"] integer +---@field x integer --- ---Top face button (Y). --- ----@field ["y"] integer +---@field y integer --- ---Back button. --- @@ -316,15 +316,15 @@ function Joystick:setVibration(left, right) end --- ---Centered --- ----@field ["c"] integer +---@field c integer --- ---Down --- ----@field ["d"] integer +---@field d integer --- ---Left --- ----@field ["l"] integer +---@field l integer --- ---Left+Down --- @@ -336,7 +336,7 @@ function Joystick:setVibration(left, right) end --- ---Right --- ----@field ["r"] integer +---@field r integer --- ---Right+Down --- @@ -348,7 +348,7 @@ function Joystick:setVibration(left, right) end --- ---Up --- ----@field ["u"] integer +---@field u integer --- ---Types of Joystick inputs. diff --git a/meta/3rd/love2d/library/love.keyboard.lua b/meta/3rd/love2d/library/love.keyboard.lua index cbe7e137..311c3225 100644 --- a/meta/3rd/love2d/library/love.keyboard.lua +++ b/meta/3rd/love2d/library/love.keyboard.lua @@ -85,107 +85,107 @@ function love.keyboard.setTextInput(enable) end --- ---The A key --- ----@field ["a"] integer +---@field a integer --- ---The B key --- ----@field ["b"] integer +---@field b integer --- ---The C key --- ----@field ["c"] integer +---@field c integer --- ---The D key --- ----@field ["d"] integer +---@field d integer --- ---The E key --- ----@field ["e"] integer +---@field e integer --- ---The F key --- ----@field ["f"] integer +---@field f integer --- ---The G key --- ----@field ["g"] integer +---@field g integer --- ---The H key --- ----@field ["h"] integer +---@field h integer --- ---The I key --- ----@field ["i"] integer +---@field i integer --- ---The J key --- ----@field ["j"] integer +---@field j integer --- ---The K key --- ----@field ["k"] integer +---@field k integer --- ---The L key --- ----@field ["l"] integer +---@field l integer --- ---The M key --- ----@field ["m"] integer +---@field m integer --- ---The N key --- ----@field ["n"] integer +---@field n integer --- ---The O key --- ----@field ["o"] integer +---@field o integer --- ---The P key --- ----@field ["p"] integer +---@field p integer --- ---The Q key --- ----@field ["q"] integer +---@field q integer --- ---The R key --- ----@field ["r"] integer +---@field r integer --- ---The S key --- ----@field ["s"] integer +---@field s integer --- ---The T key --- ----@field ["t"] integer +---@field t integer --- ---The U key --- ----@field ["u"] integer +---@field u integer --- ---The V key --- ----@field ["v"] integer +---@field v integer --- ---The W key --- ----@field ["w"] integer +---@field w integer --- ---The X key --- ----@field ["x"] integer +---@field x integer --- ---The Y key --- ----@field ["y"] integer +---@field y integer --- ---The Z key --- ----@field ["z"] integer +---@field z integer --- ---The zero key --- @@ -333,7 +333,7 @@ function love.keyboard.setTextInput(enable) end --- ---Underscore key --- ----@field ["_"] integer +---@field _ integer --- ---Grave accent key --- @@ -672,107 +672,107 @@ function love.keyboard.setTextInput(enable) end --- ---The 'A' key on an American layout. --- ----@field ["a"] integer +---@field a integer --- ---The 'B' key on an American layout. --- ----@field ["b"] integer +---@field b integer --- ---The 'C' key on an American layout. --- ----@field ["c"] integer +---@field c integer --- ---The 'D' key on an American layout. --- ----@field ["d"] integer +---@field d integer --- ---The 'E' key on an American layout. --- ----@field ["e"] integer +---@field e integer --- ---The 'F' key on an American layout. --- ----@field ["f"] integer +---@field f integer --- ---The 'G' key on an American layout. --- ----@field ["g"] integer +---@field g integer --- ---The 'H' key on an American layout. --- ----@field ["h"] integer +---@field h integer --- ---The 'I' key on an American layout. --- ----@field ["i"] integer +---@field i integer --- ---The 'J' key on an American layout. --- ----@field ["j"] integer +---@field j integer --- ---The 'K' key on an American layout. --- ----@field ["k"] integer +---@field k integer --- ---The 'L' key on an American layout. --- ----@field ["l"] integer +---@field l integer --- ---The 'M' key on an American layout. --- ----@field ["m"] integer +---@field m integer --- ---The 'N' key on an American layout. --- ----@field ["n"] integer +---@field n integer --- ---The 'O' key on an American layout. --- ----@field ["o"] integer +---@field o integer --- ---The 'P' key on an American layout. --- ----@field ["p"] integer +---@field p integer --- ---The 'Q' key on an American layout. --- ----@field ["q"] integer +---@field q integer --- ---The 'R' key on an American layout. --- ----@field ["r"] integer +---@field r integer --- ---The 'S' key on an American layout. --- ----@field ["s"] integer +---@field s integer --- ---The 'T' key on an American layout. --- ----@field ["t"] integer +---@field t integer --- ---The 'U' key on an American layout. --- ----@field ["u"] integer +---@field u integer --- ---The 'V' key on an American layout. --- ----@field ["v"] integer +---@field v integer --- ---The 'W' key on an American layout. --- ----@field ["w"] integer +---@field w integer --- ---The 'X' key on an American layout. --- ----@field ["x"] integer +---@field x integer --- ---The 'Y' key on an American layout. --- ----@field ["y"] integer +---@field y integer --- ---The 'Z' key on an American layout. --- ----@field ["z"] integer +---@field z integer --- ---The '1' key on an American layout. --- diff --git a/meta/3rd/love2d/library/love.window.lua b/meta/3rd/love2d/library/love.window.lua index dc45f1d7..21322049 100644 --- a/meta/3rd/love2d/library/love.window.lua +++ b/meta/3rd/love2d/library/love.window.lua @@ -90,7 +90,7 @@ function love.window.getIcon() end --- ---@return number width # Window width. ---@return number height # Window height. ----@return table flags # Table with the window properties: +---@return {fullscreen: boolean, fullscreentype: FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, refreshrate: number, x: number, y: number, srgb: boolean} flags # Table with the window properties: function love.window.getMode() end --- @@ -223,7 +223,7 @@ function love.window.setIcon(imagedata) end --- ---@param width number # Display width. ---@param height number # Display height. ----@param flags table # The flags table with the options: +---@param flags {fullscreen: boolean, fullscreentype: FullscreenType, vsync: boolean, msaa: number, stencil: boolean, depth: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number, usedpiscale: boolean, srgb: boolean} # The flags table with the options: ---@return boolean success # True if successful, false otherwise. function love.window.setMode(width, height, flags) end @@ -281,7 +281,7 @@ function love.window.toPixels(value) end --- ---@param width number # Window width. ---@param height number # Window height. ----@param settings table # The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode. +---@param settings {fullscreen: boolean, fullscreentype: FullscreenType, vsync: boolean, msaa: number, resizable: boolean, borderless: boolean, centered: boolean, display: number, minwidth: number, minheight: number, highdpi: boolean, x: number, y: number} # The settings table with the following optional fields. Any field not filled in will use the current value that would be returned by love.window.getMode. ---@return boolean success # True if successful, false otherwise. function love.window.updateMode(width, height, settings) end diff --git a/tools/love-api.lua b/tools/love-api.lua index f909d200..954d542f 100644 --- a/tools/love-api.lua +++ b/tools/love-api.lua @@ -45,17 +45,25 @@ local function getTypeName(names) end local function formatIndex(key) - if key:match '^[%a_][%w_]+$' then + if key:match '^[%a_][%w_]*$' then return key end return ('[%q]'):format(key) end +local buildType + local function buildDocTable(tbl) - + local fields = {} + for _, field in ipairs(tbl) do + if field.name ~= '...' then + fields[#fields+1] = ('%s: %s'):format(formatIndex(field.name), field.type) + end + end + return ('{%s}'):format(table.concat(fields, ', ')) end -local function buildType(param) +function buildType(param) if param.table then return buildDocTable(param.table) end |