« Module:Script » : différence entre les versions

Aucun résumé des modifications
Utilisation d'une "vraie" frame
Ligne 5 : Ligne 5 :
function Script:new(frame)
function Script:new(frame)
     self.__index = self
     self.__index = self
    mw.logObject(frame)
     self.template = frame.args[1]
     self.template = frame.args[1]
     self.arguments = frame.args[2]
     self.arguments = frame.args[2]
Ligne 15 : Ligne 16 :
     local command = self.template
     local command = self.template
     for key, value in pairs(self.arguments) do
     for key, value in pairs(self.arguments) do
        if value ~= nil then
        if value ~= nil then
            command = String:replace({ test = 1, args = { source = command, pattern = "{" .. key .. "}", replace = value } })
            command = String:replace(frame:newChild{title = "module invocation", args = {source = command, pattern = "{" .. key .. "}", replace = value}})
         end
         end
     end
     end