Jump to content

Module:Sandbox/Retro

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Retro (talk | contribs) at 08:41, 25 May 2019 (Simple to start with.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- 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