Module:Sandbox/VitoSmo

Revision as of 10:00, 8 November 2019 by imported>Vitosmo (Created page with '-- (Vitosmo Google Code-in, Introduction to Lua in Wikipedia) -- ________________ older code _________________________________ -- For unit tests, see [[Modul:...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/VitoSmo/doc

-- (Vitosmo Google Code-in, Introduction to Lua in Wikipedia)

-- ________________  older code _________________________________

-- For unit tests, see [[Modul:VitoSmoCode/testniprimeri]]
local p = {} --p stands for package

local i = {};

function p.helloAlt( frame )
    return "Hello, world!"
end

function p.zivjo( frame )
    return "zivjo, svet!"
end

function p.HelloArg( frame)
    return frame.args[1]
end

function p.getTitle(fname)

    return fname.args[1].getCurrentTitle()

    -- local pTitle = mw.title.getCurrentTitle()

    -- return pTitle:getContent()
end

--____________ end of older code __

-- Vitosmo Google Code-in, Task 2.

function p.hello( frame )
    return "Hello, world!"
end



-- Vitosmo Google Code-in, Task 3.
function temperature(celsius)
	cel = frame.args.celsius
	fah = cel*9 / 5 + 32
	return cel.."degrees Celsius is "..fah.." degrees Fahrenheit"
end

return p