getfenv() itself isn’t deprecated
just do getfenv(debug.info(2, 'f'))
debug.info(stackLevelNumber, ‘f’) returns the function/thread calling the function using debug.info()
getfenv() can use a stack level number or function/thread
which in this case stack level numbers used in getfenv() are deprecated but putting the function or thread in the stack
argument instead isn’t deprecated.
so yes we will now be using getfenv(debug.info(2, 'f'))
to stay up to date with roblox’s lua scripting
also note if something is deprecated it does not mean you cant use it. it just means its no longer being updated/maintained by roblox.
you can find more info on debug.info here:
https://create.roblox.com/docs/reference/engine/libraries/debug#info
This Luau RFC says the contrary and said that the function is deprecated: https://github.com/luau-lang/rfcs/blob/master/docs/deprecate-getfenv-setfenv.md
Please cite or prove this statement. The RFC I linked didn’t mention anything about only deprecating getfenv
where the argument is a caller stack index and seems to deprecate the function altogether, so the burden of proof is in you.
Never saw anything on the roblox scripting api docs ab the function(s) being deprecated. Thanks for disclosing this.
though the code listed above (getfenv(debug.info(2, 'f'))
) does seem to get rid of that annoying underline when trying to use getfenv(2)
also as said above, deprecation of an object or function does not render it unusable it just means its no longer being maintained. a lot of games still use Message/Hint object(s). So, there is nothing stopping anyone from using deprecated objects/functions.