summaryrefslogtreecommitdiff
path: root/tools/love-api.lua
diff options
context:
space:
mode:
authorC3pa <41503714+C3pa@users.noreply.github.com>2022-05-28 16:44:56 +0200
committerC3pa <41503714+C3pa@users.noreply.github.com>2022-05-28 16:44:56 +0200
commite4ebac9ac79372ad8ef772ddc7a765d304bfc4fd (patch)
tree7d7cc0c16139b3932efd80e083b8a30cc9abd096 /tools/love-api.lua
parent94d4cc3b12443916f2cbac2ccea2d4007af5c6b4 (diff)
downloadlua-language-server-e4ebac9ac79372ad8ef772ddc7a765d304bfc4fd.zip
Make code more readable by adding a new variable
Diffstat (limited to 'tools/love-api.lua')
-rw-r--r--tools/love-api.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/love-api.lua b/tools/love-api.lua
index cea488a7..960cda46 100644
--- a/tools/love-api.lua
+++ b/tools/love-api.lua
@@ -156,9 +156,10 @@ local function buildFunction(func, node, typeName)
for _, param in ipairs(func.variants[1].arguments or {}) do
for paramName in param.name:gmatch '[%a_][%w_]*' do
params[#params+1] = paramName
+ local optional = (param.type == 'table' and isTableOptional(param.table) or param.default)
text[#text+1] = ('---@param %s%s %s # %s'):format(
paramName,
- (param.type == 'table' and isTableOptional(param.table) or param.default) == nil and '' or '?',
+ optional and '?' or '',
buildType(param),
param.description
)