I want to access the environment variables that are at higher level than the environment of the current function called. I do this by using getfenv(#)
. For unknown reasons, it is behaving very oddly although it had worked just few days ago under the same measure. I expected it to return the environmental variables, but it instead returned only the basics.
Here is the sample code for observance.
local ak = "bl"
local a = getfenv(1)
print(a)
To prevent confusion, I am having this same issue for another code which is a module accessing the higher level of another module.
Indexed
STRUCT_EVENT
inbackup
but returnsnil
although still only has the basics: _G, script, and shared.
I’ve tried attempts to study what’s going on in Getfenv()
across three kind of scripts: local, server, and module. Every of them still has Getfenv() behaving oddly either way no matter the case. Are there any flaws in the usage of Getfenv() according to the codes provided? Much thanks. Obrigado. Hvala.