Difference between revisions of "Module:Extension"
Jump to navigation
Jump to search
Stop mangling the order of hooks: use the order given as parameters if parameters are provided, and alphabetical order if not
>Pppery |
>Pppery (Stop mangling the order of hooks: use the order given as parameters if parameters are provided, and alphabetical order if not) |
||
Line 297: | Line 297: | ||
local argument = pframe.args["hook" .. index] | local argument = pframe.args["hook" .. index] | ||
if argument and mw.text.trim(argument) ~= "" then | if argument and mw.text.trim(argument) ~= "" then | ||
hooks[ | hooks[#hooks + 1] = mw.text.trim(argument) | ||
foundLocalHooks = true | foundLocalHooks = true | ||
else | else | ||
Line 306: | Line 306: | ||
if not foundLocalHooks then | if not foundLocalHooks then | ||
local data = getExtData() | local data = getExtData() | ||
if data == nil then | if data == nil or data.Hooks == nil then | ||
return "" | return "" | ||
end | end | ||
for hook, _ in pairs(data.Hooks) do | |||
hooks[#hooks + 1] = hook | |||
end | end | ||
table.sort(hooks) | |||
end | end | ||
local first = true | local first = true | ||
for hook | for _, hook in ipairs(hooks) do | ||
if first then | if first then | ||
first = false | first = false |