summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
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