[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Self-awareness of functions?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 29 Dec 2010 14:37:17 -0200
> According to this page:
>
> http://www.lua.org/pil/6.2.html
>
> According to that page, there's a subtle difference between
>
> foo=function(x)
>
> and
>
> function foo(x)
>
> when it comes to declaring recursive functions. I'm not saying this has
> anything to do with your situation, I'm just pointing out that in certain
> situations they're not identical.
You are mixing two different things. The constructions
|foo=function(x)...end| and |function foo(x)...end| have exactly
the same meaning. The "subtle" difference is between
|local foo=function(x)| and |local function foo(x)|. Note that the
second form is an explicit construct in Lua,
not a |function foo(x)| inside a common 'local' declaration.
-- Roberto