From dda6b1860cf9e2efbc6b06bad4a6174481c7e5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 1 Nov 2021 21:00:14 +0800 Subject: update lovr --- tools/lovr-api.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tools/lovr-api.lua') diff --git a/tools/lovr-api.lua b/tools/lovr-api.lua index 5d382875..c5d7f95f 100644 --- a/tools/lovr-api.lua +++ b/tools/lovr-api.lua @@ -64,7 +64,7 @@ function buildType(param) if param.table then return buildDocTable(param.table) end - return getTypeName(param.type) + return getTypeName(param.type or param.name) end local function buildSuper(tp) @@ -168,6 +168,21 @@ local function buildFile(defs) text[#text+1] = buildFunction(func) end + for _, obj in ipairs(defs.objects or {}) do + local mark = {} + text[#text+1] = '' + text[#text+1] = buildDescription(obj.description) + text[#text+1] = ('---@class %s%s'):format(getTypeName(obj.name), buildSuper(obj)) + text[#text+1] = ('local %s = {}'):format(obj.name) + for _, func in ipairs(obj.methods or {}) do + if not mark[func.name] then + mark[func.name] = true + text[#text+1] = '' + text[#text+1] = buildFunction(func) + end + end + end + for _, cb in ipairs(defs.callbacks or {}) do text[#text+1] = '' text[#text+1] = buildDescription(cb.description) -- cgit v1.2.3