[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about local functions inside functions.
- From: Eduardo Ochs <eduardoochs@...>
- Date: Mon, 18 Apr 2016 06:35:22 -0300
> Function f2 becomes compiled ones when F1 becomes compiled?
yes.
> Function f2 will be compiled every time i call f1?
no.
Btw, you can run this and then look at the output...
cd /tmp/
cat > test.lua <<'%%%'
function f1()
local function f2()
return "test";
end;
return f2()
end;
%%%
luac -p -l -l test.lua
Cheers,
E. =)
On Mon, Apr 18, 2016 at 6:21 AM, Ulrich Schmidt <u.sch.zw@gmx.de> wrote:
> Hi all.
>
> Imagine the following lua code:
>
> --8<------------------------------------------------
> function f1()
> local function f2()
> return "test";
> end;
> return f2()
> end;
> --8<------------------------------------------------
>
> Question:
> Function f2 becomes compiled ones when F1 becomes compiled?
> or:
> Function f2 will be compiled every time i call f1?
>
> tia.
> Ulrich.
>