Module:Lua: Difference between revisions
Jump to navigation
Jump to search
>TheFrz mNo edit summary |
>OmegaK2 mNo edit summary |
||
Line 3: | Line 3: | ||
local util = require('Module:Util') | local util = require('Module:Util') | ||
local p = {} | local p = {} | ||
local i18n = { | |||
text = 'Uses Lua:\n', | |||
category = 'Lua-based templates', | |||
} | |||
function p.main(frame) | function p.main(frame) | ||
Line 23: | Line 28: | ||
small = true, | small = true, | ||
image = '[[File:Lua programming language logo.svg|30px|alt=Lua logo]]', | image = '[[File:Lua programming language logo.svg|30px|alt=Lua logo]]', | ||
text = | text = i18n.text .. table.concat(modules, '\n') | ||
}) .. util.misc.add_category( | }) .. util.misc.add_category(i18n.category, {namespace=10}) | ||
end | end | ||
return p | return p |
Revision as of 17:22, 19 January 2019
Lua error in package.lua at line 80: module 'Module:Message box' not found.
Implements {{Lua}}.

This module was adapted from Module:Lua banner on Wikipedia.
Adaptation is noted for reference and attribution only. This module may differ from the original in function or in usage. The documentation on Wikipedia may be helpful in understanding this module.
Adaptation is noted for reference and attribution only. This module may differ from the original in function or in usage. The documentation on Wikipedia may be helpful in understanding this module.
The above documentation is transcluded from Module:Lua/doc.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
Editors can experiment in this module's sandbox and testcases pages.
Subpages of this module.
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
local util = require('Module:Util')
local p = {}
local i18n = {
text = 'Uses Lua:\n',
category = 'Lua-based templates',
}
function p.main(frame)
local args = getArgs(frame, {
wrappers = 'Template:Lua',
trim = false
})
return p._main(args)
end
function p._main(args)
local modules = {}
for k, v in pairs(args) do
if type(k) == 'number' and k >= 1 and math.floor(k) == k and string.find(v, '%S') then
table.insert(modules, '* [[:' .. mw.text.trim(v) .. ']]')
end
end
return messageBox.main('mbox', {
type = 'notice',
small = true,
image = '[[File:Lua programming language logo.svg|30px|alt=Lua logo]]',
text = i18n.text .. table.concat(modules, '\n')
}) .. util.misc.add_category(i18n.category, {namespace=10})
end
return p