summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/3rd/love2d/library/love.audio.lua6
-rw-r--r--meta/3rd/love2d/library/love.data.lua14
-rw-r--r--meta/3rd/love2d/library/love.font.lua4
-rw-r--r--meta/3rd/love2d/library/love.graphics.lua7
-rw-r--r--meta/3rd/love2d/library/love.lua2
-rw-r--r--meta/3rd/love2d/library/love.touch.lua4
-rw-r--r--tools/love-api.lua21
7 files changed, 27 insertions, 31 deletions
diff --git a/meta/3rd/love2d/library/love.audio.lua b/meta/3rd/love2d/library/love.audio.lua
index 386f8382..bff10a8e 100644
--- a/meta/3rd/love2d/library/love.audio.lua
+++ b/meta/3rd/love2d/library/love.audio.lua
@@ -198,12 +198,6 @@ local RecordingDevice = {}
function RecordingDevice:getBitDepth() end
---
----Gets the number of bits per sample in the data currently being recorded.
----
----@return number bits # The number of bits per sample in the data that's currently being recorded.
-function RecordingDevice:getBitDepth() end
-
----
---Gets the number of channels currently being recorded (mono or stereo).
---
---@return number channels # The number of channels being recorded (1 for mono, 2 for stereo).
diff --git a/meta/3rd/love2d/library/love.data.lua b/meta/3rd/love2d/library/love.data.lua
index 91c7fa80..1bde844e 100644
--- a/meta/3rd/love2d/library/love.data.lua
+++ b/meta/3rd/love2d/library/love.data.lua
@@ -10,7 +10,7 @@ love.data = {}
---@param format love.CompressedDataFormat # The format to use when compressing the string.
---@param rawstring string # The raw (un-compressed) string to compress.
---@param level number # The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used.
----@return love.CompressedData or string compressedData # CompressedData/string which contains the compressed version of rawstring.
+---@return love.CompressedData|string compressedData # CompressedData/string which contains the compressed version of rawstring.
function love.data.compress(container, format, rawstring, level) end
---
@@ -19,7 +19,7 @@ function love.data.compress(container, format, rawstring, level) end
---@param container love.ContainerType # What type to return the decoded data as.
---@param format love.EncodeFormat # The format of the input data.
---@param sourceString string # The raw (encoded) data to decode.
----@return love.ByteData or string decoded # ByteData/string which contains the decoded version of source.
+---@return love.ByteData|string decoded # ByteData/string which contains the decoded version of source.
function love.data.decode(container, format, sourceString) end
---
@@ -27,7 +27,7 @@ function love.data.decode(container, format, sourceString) end
---
---@param container love.ContainerType # What type to return the decompressed data as.
---@param compressedData love.CompressedData # The compressed data to decompress.
----@return love.Data or string decompressedData # Data/string containing the raw decompressed data.
+---@return love.Data|string decompressedData # Data/string containing the raw decompressed data.
function love.data.decompress(container, compressedData) end
---
@@ -37,7 +37,7 @@ function love.data.decompress(container, compressedData) end
---@param format love.EncodeFormat # The format of the output data.
---@param sourceString string # The raw data to encode.
---@param linelength number # The maximum line length of the output. Only supported for base64, ignored if 0.
----@return love.ByteData or string encoded # ByteData/string which contains the encoded version of source.
+---@return love.ByteData|string encoded # ByteData/string which contains the encoded version of source.
function love.data.encode(container, format, sourceString, linelength) end
---
@@ -82,8 +82,8 @@ function love.data.newDataView(data, offset, size) end
---
---@param container love.ContainerType # What type to return the encoded data as.
---@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings.
----@param v1 love.number or boolean or string # The first value (number, boolean, or string) to serialize.
----@return love.Data or string data # Data/string which contains the serialized data.
+---@param v1 number|boolean|string # The first value (number, boolean, or string) to serialize.
+---@return love.Data|string data # Data/string which contains the serialized data.
function love.data.pack(container, format, v1) end
---
@@ -94,7 +94,7 @@ function love.data.pack(container, format, v1) end
---@param format string # A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings.
---@param datastring string # A string containing the packed (serialized) data.
---@param pos number # Where to start reading in the string. Negative values can be used to read relative from the end of the string.
----@return love.number or boolean or string v1 # The first value (number, boolean, or string) that was unpacked.
+---@return number|boolean|string v1 # The first value (number, boolean, or string) that was unpacked.
---@return number index # The index of the first unread byte in the data string.
function love.data.unpack(format, datastring, pos) end
diff --git a/meta/3rd/love2d/library/love.font.lua b/meta/3rd/love2d/library/love.font.lua
index 7ec34ef3..e419e5d7 100644
--- a/meta/3rd/love2d/library/love.font.lua
+++ b/meta/3rd/love2d/library/love.font.lua
@@ -154,8 +154,8 @@ function Rasterizer:getLineHeight() end
---
---Checks if font contains specified glyphs.
---
----@param glyph1 love.string or number # Glyph
----@param glyph2 love.string or number # Glyph
+---@param glyph1 string|number # Glyph
+---@param glyph2 string|number # Glyph
---@return boolean hasGlyphs # Whatever font contains specified glyphs.
function Rasterizer:hasGlyphs(glyph1, glyph2) end
diff --git a/meta/3rd/love2d/library/love.graphics.lua b/meta/3rd/love2d/library/love.graphics.lua
index 43de9830..88ad2410 100644
--- a/meta/3rd/love2d/library/love.graphics.lua
+++ b/meta/3rd/love2d/library/love.graphics.lua
@@ -1116,13 +1116,6 @@ local Mesh = {}
function Mesh:attachAttribute(name, mesh) end
---
----Attaches a vertex attribute from a different Mesh onto this Mesh, for use when drawing. This can be used to share vertex attribute data between several different Meshes.
----
----@param name string # The name of the vertex attribute to attach.
----@param mesh love.Mesh # The Mesh to get the vertex attribute from.
-function Mesh:attachAttribute(name, mesh) end
-
----
---Removes a previously attached vertex attribute from this Mesh.
---
---@param name string # The name of the attached vertex attribute to detach.
diff --git a/meta/3rd/love2d/library/love.lua b/meta/3rd/love2d/library/love.lua
index a4e14d06..081175f8 100644
--- a/meta/3rd/love2d/library/love.lua
+++ b/meta/3rd/love2d/library/love.lua
@@ -48,7 +48,7 @@ function Data:getFFIPointer() end
---
---Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.
---
----@return lightuserdata pointer # A raw pointer to the Data.
+---@return love.light|userdata pointer # A raw pointer to the Data.
function Data:getPointer() end
---
diff --git a/meta/3rd/love2d/library/love.touch.lua b/meta/3rd/love2d/library/love.touch.lua
index a5f9b073..9ab497fa 100644
--- a/meta/3rd/love2d/library/love.touch.lua
+++ b/meta/3rd/love2d/library/love.touch.lua
@@ -6,13 +6,13 @@ love.touch = {}
---
---Gets the current position of the specified touch-press, in pixels.
---
----@param id lightuserdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.
+---@param id love.light|userdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.
function love.touch.getPosition(id) end
---
---Gets the current pressure of the specified touch-press.
---
----@param id lightuserdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.
+---@param id love.light|userdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values.
---@return number pressure # The pressure of the touch-press. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.
function love.touch.getPressure(id) end
diff --git a/tools/love-api.lua b/tools/love-api.lua
index 5aec88e0..e4227d65 100644
--- a/tools/love-api.lua
+++ b/tools/love-api.lua
@@ -26,15 +26,19 @@ local knownTypes = {
['light userdata'] = 'lightuserdata'
}
-local function getTypeName(name)
- if knownTypes[name] then
- return knownTypes[name]
+local function getTypeName(names)
+ local types = {}
+ for name in names:gmatch '[%a_][%w_]+' do
+ if name ~= 'or' then
+ types[#types+1] = knownTypes[name] or ('love.' .. name)
+ end
end
- return 'love.' .. name
+ return table.concat(types, '|')
end
local function buildType(param)
if param.table then
+ -- TODO
getTypeName(param.type)
end
return getTypeName(param.type)
@@ -103,15 +107,20 @@ local function buildFile(class, defs)
end
for _, tp in ipairs(defs.types or {}) do
+ local mark = {}
text[#text+1] = ''
text[#text+1] = ('---@class %s%s'):format(getTypeName(tp.name), buildSuper(tp))
text[#text+1] = ('local %s = {}'):format(tp.name)
for _, func in ipairs(tp.functions or {}) do
- text[#text+1] = ''
- text[#text+1] = buildFunction(class, func, tp.name .. ':')
+ if not mark[func.name] then
+ mark[func.name] = true
+ text[#text+1] = ''
+ text[#text+1] = buildFunction(class, func, tp.name .. ':')
+ end
end
end
+ -- TODO
for _, tp in ipairs(defs.callbacks or {}) do
text[#text+1] = ''
text[#text+1] = ('---@type %s'):format(getTypeName(tp.name))