6,834
edits
No edit summary |
No edit summary |
||
Line 580: | Line 580: | ||
local parameters = p.getIndexedArgs(frame, 'arg') | local parameters = p.getIndexedArgs(frame, 'arg') | ||
for i=1, #parameters do | for i=1, #parameters do | ||
local callbackSyntax | local callbackSyntax | ||
local callbackText = args['cb'..i..'Text'..suffix] | local callbackText = args['cb'..i..'Text'..suffix] | ||
local callbackNParameters = p.getIndexedArgs(frame, 'cb'..i..'arg'..suffix) | local callbackNParameters = p.getIndexedArgs(frame, 'cb'..i..'arg'..suffix) | ||
Line 607: | Line 607: | ||
elseif #entries == 0 then | elseif #entries == 0 then | ||
elseif entries[1] == "void" then | elseif entries[1] == "void" then | ||
table.insert( | table.insert(callbackSyntax, 'void') | ||
else | else | ||
for i,arg in ipairs(entries) do | for i,arg in ipairs(entries) do | ||
Line 620: | Line 620: | ||
if isOptional then | if isOptional then | ||
table.insert( | table.insert(callbackSyntax, '[ '..tokens[1]..' '..tokens[2]..' = '..defaultValue..' ]') | ||
else | else | ||
table.insert( | table.insert(callbackSyntax, tokens[1]..' '..tokens[2]) | ||
end | end | ||
end | end | ||
Line 628: | Line 628: | ||
end | end | ||
callbackSyntax = p.loadTemplate(frame, 'CodeSyntax', { | |||
'function('..(# | 'function('..(#callbackSyntax == 0 and 'void' or table.concat(callbackSyntax, ', ')..')') | ||
}) | }) | ||
edits