User:Codemini/Lua Tutorial/Getting started

Getting started

On a Wiki with Scribunto enabled, create a page with a title starting with Module:, for example "Module:Example". Into this new page, copy the following texts:

local p = {} -- p stands as the package name

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

return p

Save that, then on another non-module page, as on a sandbox page, write:

{{#invoke:Example|hello}}

which will return the text: Hello, world!.

Previous Next