-- Get the environment based on stack
local function whatIsThePassword(password)
local env = getfenv(1) -- Get the environment 1 level up, or whatever called this function
print(env.password) -- Get the password from the environment one level up
print(password) --> nil
end
local function openSesame()
local password = "secret" -- A variable local to openSesame()
whatIsThePassword(password)
end
openSesame()