lua-users home
lua-l archive

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


On Mar 30, 2012, at 11:22 PM, Petite Abeille wrote:

> In 5.2, the same process doesn't seem to work any longer.

Another luac & 5.2 weirdness.

Assuming the following setup:


$ cat TestA.lua
local print = print
local _NAME = ...
local _ENV = {}

print( 'TestA', _NAME )

return _ENV


$ cat TestB.lua
local print = print
local _NAME = ...
local _ENV = {}

print( 'TestB', _NAME )

return _ENV


$ cat TestC.lua
local TestA = require( 'TestA' )
local TestB = require( 'TestB' )

print( 'TestC' )


$ lua TestC.lua
TestA	TestA
TestB	TestB
TestC


All good. Each module gets loaded once.


Now… same, but with luac:


$ luac -o TestC.luac TestA.lua TestB.lua TestC.lua

$ 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.

Bug or feature?

What gives?