As of version 0.649, optimisations are not disabled after a call to getfenv/setfenv if they are accessed via _G, causing strange behaviour:
--!optimize 2
--returns 0 at o2, but throws if setfenv is accessed directly or at other optimisation levels
local function band(a:number, b:number): number
_G.setfenv(1, {})
return bit32.band(a, b)
end
print(band(1, 2))
As of version 0.649, optimisations are not disabled after a call to
getfenv
/setfenv
if they are accessed via_G
, causing strange behaviour: