User:Ganaram inukshuk/Provisional style guide for Lua: Difference between revisions

Ganaram inukshuk (talk | contribs)
Tags: Reverted Visual edit
Ganaram inukshuk (talk | contribs)
Tags: Manual revert Visual edit
Line 148: Line 148:


=== Use of wrapper functions ===
=== Use of wrapper functions ===
Recommended, but may be disregarded for simple modules, or modules whose code should not be called by another module. The use of a wrapper and "main" function allows for a module to be used directly in another module or indirectly through its corresponding template. This also allows for code testing by calling the "main" function, or through a tester function.<syntaxhighlight lang="lua">
Recommended, but may be disregarded for simple modules. The use of a wrapper and "main" function allows for a module to be used directly in another module or indirectly through its corresponding template. This also allows for code testing by calling the "main" function, or through a tester function.<syntaxhighlight lang="lua">
-- "Main" function to be called by wrapper or another module
-- "Main" function to be called by wrapper or another module
function p._call_me(args)
function p._call_me(args)