summaryrefslogtreecommitdiffhomepage
path: root/lua.html.markdown
diff options
context:
space:
mode:
authorRob Hoelz <rob@hoelz.ro>2013-09-04 11:39:15 +0200
committerRob Hoelz <rob@hoelz.ro>2013-09-04 11:39:15 +0200
commit6c53c05dcc25e74885411832839aa19ff46ee66a (patch)
treefb84d344ac9ef14fcd7df1c3be7c3cc5c0c11e81 /lua.html.markdown
parent412b312c45ccb8922f92c4ee364819fb0add7734 (diff)
Clarify self-referential local functions
The current language used implies that `local function f() ... end` does not allow f to invoke itself. This has been clarified via the addition of an example of a local function that may *not* invoke itself.
Diffstat (limited to 'lua.html.markdown')
-rw-r--r--lua.html.markdown3
1 files changed, 3 insertions, 0 deletions
diff --git a/lua.html.markdown b/lua.html.markdown
index 7325a1cf..35d68e9b 100644
--- a/lua.html.markdown
+++ b/lua.html.markdown
@@ -125,6 +125,9 @@ f = function (x) return x * x end
-- And so are these:
local function g(x) return math.sin(x) end
+local g = function(x) return math.xin(x) end
+-- Equivalent to local function g(x)..., except referring
+-- to g in the function body won't work as expected.
local g; g = function (x) return math.sin(x) end
-- the 'local g' decl makes g-self-references ok.