|
from the manual:On Tue, Dec 30, 2008 at 2:14 PM, Linker <linker.m.lin@gmail.com> wrote:
> 1:
> local function n() print(n);n();end
> n()
> infinite loop
> 2:
> local n2=function() print(n2);n2();end
> n2()
> output: nil
> error:attempt to call global 'n2' (a nil value)
> Why?
> --
> Regards,
> Linker Lin
> linker.m.lin@gmail.com
>
2.5.9 - Function Definitions
.....snip...
The statement
local function f () body end
translates to
local f; f = function () body end
not to
local f = function () body end
(This only makes a difference when the body of the function contains
references to f.)
--
Javier