Module:Sandbox/Retro: Difference between revisions
Appearance
Content deleted Content added
m Retro moved page Module:Sandbox/E to the Pi times i to Module:Sandbox/Retro without leaving a redirect: User rename |
Simple to start with. |
||
Line 2: | Line 2: | ||
local p = {} -- p stands for package |
local p = {} -- p stands for package |
||
function p.hello( |
function p.hello(frame) |
||
return "Hello, world!" |
return "Hello, world!" |
||
end |
end |
||
function p.fizzbuzz( |
function p.fizzbuzz(frame) |
||
for i = 1, 100 do |
for i = 1, 100 do |
||
outNum = "" |
outNum = "" |
||
Line 20: | Line 20: | ||
mw.log(outNum) |
mw.log(outNum) |
||
end |
end |
||
end |
|||
function p.frameTest(frame) |
|||
return mw.getCurrentFrame() == frame |
|||
end |
end |
||
Revision as of 08:41, 25 May 2019
This page is used to organize my WIP modules. E to the Pi times i (talk | contribs) 16:53, 7 April 2018 (UTC)
I definitely want to come back here. I've worked with LUA a bit more since I took my break, so hopefully I can jump right in (though I'm no expert LUA programmer). eπi (talk | contribs) 10:10, 7 May 2019 (UTC)
Subpages
Now I'm actually drafting some modules:
-- A LUA comment, unlike the comments of C++ and Java (which use "//" and "/* */"); and html (which uses "<!-- -->")
local p = {} -- p stands for package
function p.hello(frame)
return "Hello, world!"
end
function p.fizzbuzz(frame)
for i = 1, 100 do
outNum = ""
if i % 3 == 0 then
outNum = outNum .. "Fizz"
end
if i % 5 == 0 then
outNum = outNum .. "Buzz"
end
if outNum == "" then
outNum = i
end
mw.log(outNum)
end
end
function p.frameTest(frame)
return mw.getCurrentFrame() == frame
end
return p