Module:UserLinks/sandbox: Difference between revisions

Content deleted Content added
re-add the "not a valid link code" error
fix __index metamethod - should return extra links, not just memoize them
Line 61:
end
 
local function addExtraLinkmemoizeExtraLink(code, func)
local success, link = pcall(func, snippets)
if success and type(link) == 'string' then
links[code] = link
return link
end
return nil
end
 
Line 85 ⟶ 87:
local extraLinkFunction = extraLinkFunctions[code]
if type(extraLinkFunction) == 'function' then
addExtraLinklink = memoizeExtraLink(code, extraLinkFunction)
end
end
Line 100 ⟶ 102:
for code, func in pairs(extraLinkFunctions) do
if validateCode(code) and type(func) == 'function' then
addExtraLinkmemoizeExtraLink(code, func)
end
end