It would be great if a script reading an env. table without ever writing to it was allowed to keep the optimizations. But as it’s been described, this is not the case.
Will assigning a library’s member to a variable or table cause any issues? I’m currently storing all global functions inside a table to keep my code clean in non-performance critical scripts.
An example:
local global = {abs = math.abs}--will this in any way affect the next line?
local val = math.abs(-5)
I temporarily disabled this error message locally and ran the code, it produces this output:
17:52:45.916 - ResetButtonCallback must be set to a BindableEvent or a boolean
The change unfortunately causes an error before we can get to this warning message, so when this situation happens it is less clear what actually went wrong.
In the new Lua vm.
This way of calling a method in a Instance: Instance( method name )
How I used the method: game(“GetService”, “Players”)
Basically, another wall to call a method, but with more control and freedom.
Sadly, this was broken. Instead of the method doing what it is suppose to do. It errors.
attempt to call a userdata value
So, can we keep this feature. So that we don’t have to use loadstring or some other hidden methods of calling a method in Instance. Thanks!
Is there any way an exception could be made for things like getfenv(2).script? I believe that is by far the most common form of using getfenv or setfenv and in my opinion the most acceptable. The optimizations could be applied to a lot more existing code if getfenv(number).script didn’t disable the optimizations.
Currently getting some odd results with the following code:
local t = tick();
repeat wait()
local part = Instance.new('Part', game.ReplicatedStorage);
game:GetService('Debris'):AddItem(part, 3);
if (tick()-t > 3) then
print(part);
wait()
print(part);
delay(0, function()
print(part('aaa'), part);
end)
delay(1, function()
print(part);
end)
end
until tick()-t > 3
print('BREAKING')