Module:ScriptItem: Difference between revisions

no edit summary
No edit summary
 
No edit summary
Line 362: Line 362:
return p.documentationMissing(frame, "Parameters")
return p.documentationMissing(frame, "Parameters")
elseif entries[1] == "void" then
elseif entries[1] == "void" then
local headers = { "Type", "Description" }
local headers = nil
local rows = { { "void", "This "..args.type.." doesn't take any parameters." } }
local rows = { { "void", "This "..args.type.." doesn't take any parameters." } }
local widths = { 100, 400 }
local widths = { 100, 400 }
Line 371: Line 371:
local isOptional = tokens[3] == 'optional'
local isOptional = tokens[3] == 'optional'
local presenceText = isOptional and "optional" or "required"
local defaultValue = isOptional and p.formatSource(tokens[4], frame) or "n/a"
local defaultValue = isOptional and p.formatSource(tokens[4], frame) or "n/a"
local description = p.formatDescription(table.concat(tokens, ' ', isOptional and 5 or 3))
local description = p.formatDescription(table.concat(tokens, ' ', isOptional and 5 or 3))
if isEvent then
if isEvent then
rows[i] = { p.formatType(tokens[1], frame), p.formatSource(tokens[2], frame), description }
rows[i] = { i..") ", p.formatType(tokens[1], frame), p.formatSource(tokens[2], frame), description }
else
else
rows[i] = { p.formatType(tokens[1], frame), p.formatSource(tokens[2], frame), presenceText, defaultValue, description }
rows[i] = { i..") ", p.formatType(tokens[1], frame), p.formatSource(tokens[2], frame), (isOptional and ("Optional, defaults to "..defaultValue..". ") or "")..description }
end
end
end
end
Line 384: Line 383:
if isEvent then
if isEvent then
table.insert(rows, 1, { p.formatType("Event", frame), "event", "The event object for this event." })
table.insert(rows, 1, { "1) ", p.formatType("Event", frame), "event", "The event object for this event." })
end
end
local headers, widths
local headers, widths
if isEvent then
if isEvent then
headers = { "Type", "Name", "Description" }
headers = nil--{ "Type", "Name", "Description" }
widths = { 100, 180, 400 }
widths = { 50, 200, 100, 400 }
else
else
headers = { "Type", "Name", "Presence", "Default Value", "Description" }
headers = nil--{ "Type", "Name", "Presence", "Default Value", "Description" }
widths = { 100, 180, 100, 180, 400 }
widths = { 50, 200, 100, 400 }
end
end
return p.table(headers, rows, widths, 'wikitable-parameters wikitable')
return p.table(headers, rows, widths, 'wikitable-parameters wikitable')
6,833

edits