lua-users home
lua-l archive

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


David Burgess wrote:
Can anyone tell me how in Lua 5.2 (not C) that one gets access to the current environment table? i.e. the old 5.1 getfenv(1)

DB


debug.getfenv(debug.getinfo(1,"f").func)

In other words, unlike the old getfenv(), debug.getfenv wants a reference to the function itself, not just a stack level (since it also operates on userdata objects)