« Module:Script » : différence entre les versions
Page créée avec « local Script = {} local String = require('Module:String') local p = {} function Script:new(template, arguments) self.__index = self self.template = template self.arguments = arguments end function Script:build() local root = mw.html.create() local command = self.template for key, value in pairs(self.arguments) do command = String:replace(command, "{" .. key .. "}", value) end root:wikitext(command) return tostring(ro... » |
(Aucune différence)
|
Version du 4 mars 2025 à 02:50
La documentation pour ce module peut être créée à Module:Script/doc
local Script = {}
local String = require('Module:String')
local p = {}
function Script:new(template, arguments)
self.__index = self
self.template = template
self.arguments = arguments
end
function Script:build()
local root = mw.html.create()
local command = self.template
for key, value in pairs(self.arguments) do
command = String:replace(command, "{" .. key .. "}", value)
end
root:wikitext(command)
return tostring(root)
end
function p:main(frame)
local script = Script:new(frame.args[1], frame.args[2])
return script:build()
end
return p