Module:ScriptItem2: Difference between revisions

Jump to navigation Jump to search
no edit summary
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 = args['cb'..i..'Syntax'..suffix]
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(argsText, 'void')
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(argsText, '[ '..tokens[1]..' '..tokens[2]..' = '..defaultValue..' ]')
table.insert(callbackSyntax, '[ '..tokens[1]..' '..tokens[2]..' = '..defaultValue..' ]')
else
else
table.insert(argsText, tokens[1]..' '..tokens[2])
table.insert(callbackSyntax, tokens[1]..' '..tokens[2])
end
end
end
end
Line 628: Line 628:
end
end
argsText = p.loadTemplate(frame, 'CodeSyntax', {
callbackSyntax = p.loadTemplate(frame, 'CodeSyntax', {
'function('..(#argsText == 0 and 'void' or table.concat(argsText, ', ')..')')
'function('..(#callbackSyntax == 0 and 'void' or table.concat(callbackSyntax, ', ')..')')
})
})


6,834

edits

Navigation menu