[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luac & 5.2?
- From: Patrick Donnelly <batrick@...>
- Date: Fri, 30 Mar 2012 18:38:12 -0400
On Fri, Mar 30, 2012 at 6:29 PM, Petite Abeille
<petite.abeille@gmail.com> wrote:
> $ lua TestC.luac
> TestA nil
> TestB nil
> TestA TestA
> TestB TestB
> TestC
>
> Note how the modules have been invoked twice, once with a null argument, and once with their file name.
This is clearly caused by the "main" function generated by luac
running each source file successively. Finally, the two require lines
in TestC.lua loading each Test[AB].lua file again and running them.
I don't have time to check but I suspect luac is generating a main
function that looks like this:
do
<TestA.lua>
end
do
<TestB.lua>
end
do
<TestC.lua>
end
When using the (deprecated) module function, it changes the _ENV of
this main function and so sabotages all source files later on.
--
- Patrick Donnelly