lua-users home
lua-l archive

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


>From manual:
"As a special case, when f is 0 setfenv changes the global environment of the running thread."

Why following script prints nil?
---
local env = {key = "test", next = next, pairs = pairs}
setmetatable(env, {__index = _G})
setfenv(0, env)
print(key)
---