Module:UserLinks/sandbox: Difference between revisions

Content deleted Content added
convert p.getLinkFunctions to p.getLinks, so that we don't load the /extra module every time; __pairs function still buggy
update the p.linktable function to use the new links table
Line 508:
local args = {user = 'Example'}
local snippets = p.getSnippets(args)
local linkFunctionslinks = p.getLinkFunctionsgetLinks(snippets)
 
-- Assemble the codes and links in order
Line 515:
for i, code in ipairs(firstCodes) do
firstCodesKeys[code] = true
firstLinks[#firstLinks + 1] = {code, linklinks[code]}
local success, link = pcall(linkFunctions[code], snippets)
if success then
firstLinks[#firstLinks + 1] = {code, link}
else
return makeWikitextError(result, true)
end
end
local secondLinks = {}
for code, linkFunctionlink in pairs(linkFunctionslinks) do
if not firstCodesKeys[code] then
secondLinks[#secondLinks + 1] = {code, link}
local success, link = pcall(linkFunction, snippets)
if success then
secondLinks[#secondLinks + 1] = {code, link}
else
return makeWikitextError(result, true)
end
end
end