Module:ScriptItem: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 404: Line 404:
local headers
local headers
local widths
local widths
local isVoidReturn = false
rows = {}
rows = {}
Line 419: Line 420:
local description
local description
if type:lower() == "void" then
if type:lower() == "void" then
isVoidReturn = true
description = "This "..args.type.." doesn't return any values on success."
description = "This "..args.type.." doesn't return any values on success."
elseif tokens[2] then
elseif tokens[2] then
Line 426: Line 428:
end
end
rows[i] = { p.formatType(tokens[1], frame), description }
rows[i] = { '', p.formatType(tokens[1], frame), description }
end
end
headers = nil-- { "Type", "Description" }
headers = nil-- { "Type", "Description" }
widths = { 100, 400 }
widths = { 30, 80, 400 }
text = text..p.table(headers, rows, widths, 'wikitable-returns wikitable')
text = text..p.table(headers, rows, widths, 'wikitable-returns wikitable')
end
end
rows = {}
if not isVoidReturn then
entries = p.getIndexedArgs(frame, 'returnFail')
rows = {}
text = text.."'''Failure Returns'''\n\n"
entries = p.getIndexedArgs(frame, 'returnFail')
if #entries == 0 then
text = text.."'''Failure Returns'''\n\n"
text = text..p.documentationMissing(frame, "Failure returns")
if #entries == 0 then
else
text = text..p.documentationMissing(frame, "Failure returns")
for i,arg in ipairs(entries) do
else
local tokens = p.split(arg, ' ')
for i,arg in ipairs(entries) do
local tokens = p.split(arg, ' ')
local type = tokens[1]
type = p.standardizeNullType(type)
local type = tokens[1]
type = p.standardizeNullType(type)
local value
if type:lower() == 'void' then
local value
value = "n/a"
if type:lower() == 'void' then
elseif tokens[2] then
value = "n/a"
value = p.formatSource(table.concat(tokens, ' ', 2), frame)
elseif tokens[2] then
else
value = p.formatSource(table.concat(tokens, ' ', 2), frame)
value = p.formatSource(p.documentationMissing(frame, "Description for failure return value"), frame)
else
value = p.formatSource(p.documentationMissing(frame, "Description for failure return value"), frame)
end
rows[i] = { '', p.formatType(tokens[1], frame), value }
end
end
headers = nil--{ "Type", "Value" }
rows[i] = { p.formatType(tokens[1], frame), value }
widths = { 30, 100, 400 }
text = text..p.table(headers, rows, widths, 'wikitable-returns wikitable')
end
end
headers = nil--{ "Type", "Value" }
widths = { 100, 400 }
text = text..p.table(headers, rows, widths, 'wikitable-returns wikitable')
end
end
6,834

edits

Navigation menu