-- program using _ENV
local a = 'local var'
do
local _ENV = require 'mod'
print(a) --> local var
end
A potential solution would be to introduce a new "global" or "unlocal" keyword, which would force the compiler to perform a global (_ENV) access, overriding the local scope of a variable.
local a = 'local var'
do
local _ENV = require 'mod'
global a
print(a) --> from module
end