Module:ScriptItem2: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 599: Line 599:
local description = p.formatDescription(table.concat(callbackTokens, ' ', 3))
local description = p.formatDescription(table.concat(callbackTokens, ' ', 3))
local argsText = {}
do
do
local entries = p.getIndexedArgs(frame, 'arg')
if parameterType == "void" then
local isEvent = args.type == 'event'
if isEvent and args.syntax and args.syntax:lower() == 'event event' then
elseif #entries == 0 then
elseif entries[1] == "void" then
table.insert(callbackSyntax, 'void')
table.insert(callbackSyntax, 'void')
else
else
for i,arg in ipairs(entries) do
table.insert(callbackSyntax, '[ '..tokens[1]..' '..tokens[2]..' = '..defaultValue..' ]')
local tokens = p.split(arg, ' ')
local isOptional = tokens[1]:sub(1, 1) == '['
if isOptional then
tokens[1] = tokens[1]:sub(2, tokens[1]:len())
tokens[4] = tokens[4]:sub(1, tokens[4]:len() - 1)
end
local defaultValue = isOptional and tokens[4] or "n/a"
if isOptional then
table.insert(callbackSyntax, '[ '..tokens[1]..' '..tokens[2]..' = '..defaultValue..' ]')
else
table.insert(callbackSyntax, tokens[1]..' '..tokens[2])
end
end
end
end
end
end
6,833

edits