Skip to content

Commit e4ebac9

Browse files
committed
Make code more readable by adding a new variable
1 parent 94d4cc3 commit e4ebac9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/love-api.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ local function buildFunction(func, node, typeName)
156156
for _, param in ipairs(func.variants[1].arguments or {}) do
157157
for paramName in param.name:gmatch '[%a_][%w_]*' do
158158
params[#params+1] = paramName
159+
local optional = (param.type == 'table' and isTableOptional(param.table) or param.default)
159160
text[#text+1] = ('---@param %s%s %s # %s'):format(
160161
paramName,
161-
(param.type == 'table' and isTableOptional(param.table) or param.default) == nil and '' or '?',
162+
optional and '?' or '',
162163
buildType(param),
163164
param.description
164165
)

0 commit comments

Comments
 (0)