Will overriding global functions deoptimize LuaU?

Relevant page for LuaU optimizations

I’m aware that changing the environment with setfenv or reading from the environment with getfenv will disable LuaU optimizations, but does this apply when overriding global functions?
Example:

local OldPrint = print

function print(...)
	OldPrint("Example", ...)
end

bumping because it got no replies

Full transparency, I don’t know. Just to be safe you could make a newPrint instead of an oldPrint maybe?

1 Like

I know that will work, I’m just curious to know if the function above disables optimizations

Yeah, I suspected that was the case. I searched around for a bit, wasn’t able to find any clear answers sadly. I’d probably avoid it just to be safe.

1 Like