Jump to content

User:Codemini/Lua Tutorial/Getting started

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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