Difference between revisions of "Module:Sandbox"
Jump to navigation
Jump to search
blackwiki>Ohm100 |
|||
Line 1: | Line 1: | ||
--ohmoma100 | --ohmoma100 | ||
-- [Lua task #3] Create your own Lua module on English Wikipedia | -- [Lua task #3] Create your own Lua module on English Wikipedia | ||
− | + | p = {} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | p.times = function(frame) | ||
+ | local num = tonumber( frame.args.num ) or 2 | ||
+ | local out = "Times table<br>" | ||
+ | for i = 1, 10 do | ||
+ | out = out .. i * num .. "<br>" | ||
+ | end | ||
+ | return out | ||
end | end | ||
+ | |||
return p | return p | ||
− |
Revision as of 05:50, 19 December 2017
Scribunto Testing Area
This is not an actual Lua module. It exists to provide a convenient pseudo-namespace for code testing, hopefully preventing the main Module: namespace from becoming littered with experiments, as Lua modules cannot exist as subpages in the User: namespace.
Please name your experimental modules in the following format to help keep things tidy:
Module:Sandbox/Your User Name/Module name
You can use Special:PrefixIndex/Module:Sandbox to list modules in this area.
--ohmoma100
-- [Lua task #3] Create your own Lua module on English Wikipedia
p = {}
p.times = function(frame)
local num = tonumber( frame.args.num ) or 2
local out = "Times table<br>"
for i = 1, 10 do
out = out .. i * num .. "<br>"
end
return out
end
return p