Module:Bananas
Jump to navigation
Jump to search
CodeDiscussionEditHistoryLinksLink count
Subpages:DocumentationTestsResultsSandboxLive code All modules
Lua

Module:Bananas (talk · edit · hist · links · doc · subpages · tests / results · sandbox · all modules)
Example Lua module that contains a single function.
hello[edit]
{{subst:dtag|nowiki|{{#invoke:bananas|hello}}}}
→ Hello, world!
Code
-- For unit tests, see [[Module:Bananas/tests]]
local p = {}
function p.hello()
return "Hello, world!"
end
setmetatable(p, {
quickTests = function ()
if type(p.hello()) ~= 'string' then return false, 'there was an error' end
return true
end
} )
return p