summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-20 19:40:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-20 19:40:14 +0800
commit2646668ef25f8a90d07f2cc929a037e62c729381 (patch)
tree042f6c08a0b092c7148f349bdfad0f2b7b1dfb5c /tools
parent7801b00a804bcd68aacda265afdf4d774486b4e9 (diff)
downloadlua-language-server-2646668ef25f8a90d07f2cc929a037e62c729381.zip
update
Diffstat (limited to 'tools')
-rw-r--r--tools/love-api.lua14
1 files changed, 11 insertions, 3 deletions
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