Module:Bac à sable/Outils
La documentation de ce module est générée par le modèle {{Documentation module}}.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
function Outils.extractArgsGreedy( frame )
if type( frame.getParent ) == 'function' then
local args = {}
for k, v in pairs( frame.args ) do
args[ k ] = v;
end
for k, v in pairs( frame:getParent().args ) do
args[ k ] = v;
end
return args
else
return frame
end
end
function Outils.extractArgsLazy( frame )
if type( frame.getParent ) ~= 'function' then
return frame
end
local directArgs = frame.args
local parentArgs = frame:getParent().args
local nilArgs = {}
local args = {}
setmetatable( args, {
__index = function ( t, key )
if nilArgs[ key ] then
return nil
end
local directArg = directArgs[ key ]
if directArg ~= nil then
t[ key ] = directArg
return directArg
end
local parentArg = parentArgs[ key ]
if parentArg ~= nil then
t[ key ] = parentArg
return parentArg
end
nilArgs[ key ] = true
return nil
end
} )
return args
end