How to access information about all functions in an environment(like getfenv)

  1. I want to get information about all of the functions in an environment without using getfenv because getfenv disables some script optimizations

  2. The problem is I can’t find any way to do this, I’ve tried using debug.info but I’m pretty sure it can only give information about a single function not all functions in an environment

  3. I’ve tried looking on the developer forum but I couldn’t find anything that works.

This is what I want to achieve:

local env = getfenv(0)

for _, v in env do
	if typeof(v) == "function" then
		debug.info(v, "snlaf")
	end
end

Not possible ¯\_(ツ)_/¯ The entire reason getfenv disables certain specific optimizations is because it lets you view the environment dynamically. If there was an alternative, it would be a bug.

However, I believe that some of the optimizations it disables can actually be replicated in Luau directly, such as caching library functions in variables (i.e. local floor = math.floor)