User:Ganaram inukshuk/Provisional style guide for Lua: Difference between revisions
Tags: Manual revert Visual edit |
|||
| Line 133: | Line 133: | ||
=== Use of nested functions === | === Use of nested functions === | ||
Recommended, but may be disregarded for testing. | Recommended for functions whose helper functions only serve that function, but may be disregarded for testing. Nested functions have access to the variables and parameters of the outer function, so an equivalent nested function may require fewer parameters.<syntaxhighlight lang="lua"> | ||
function some_function(args) | function some_function(args) | ||
-- Get args here | -- Get args here | ||
| Line 140: | Line 140: | ||
-- Helper function | -- Helper function | ||
function helper_function(some_value) | |||
end | end | ||