lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Sep 8, 2018 at 7:26 AM Axel Kittenberger <axkibe@gmail.com> wrote:
> The issue is with recursive functions. You can't do that simply with the "name = function()" syntax.

I think it is possible, continue reading.

On Sun, Sep 9, 2018 at 3:43 PM Albert Chan <albertmcchan@yahoo.com> wrote:
> it work because a is a global function, not local.

True, but the following is not, and it still works

```
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> local a; a=function(x) print(x); if x>0 then a(x-1); end end; a(3)
3
2
1
0
> print(a)
nil
```

On Sun, Sep 9, 2018 at 11:53 AM Francisco Olarte <folarte@peoplecall.com> wrote:
>
> F.O.S.
> ( Note/disclaimer: I  like function a(x) better )
>

Same for me!