i am just curious
i see some scripts where they put something like this
local setmetatable = setmetatable
what is the point of doing this?
i am just curious
i see some scripts where they put something like this
local setmetatable = setmetatable
what is the point of doing this?
A global variable works for the entire script. You can set a global variable by doing this:
Variable = 1
A local variable will only work for the “part of the code it’s in”.
Here’s some example:
for i = 1,10 do
local Variable = 1
print(Variable) -- Prints out 1
end
print(Variable) -- Prints out nil
Sorry, I’m not a good teacher XD
It was a method used to slightly increase performance of a script by directly setting the function into a variable so it references will reference the variable to get the function instead of making the script have to look up the function to retrieve it
You can still use this and it would still allow the code to work, but in terms of performance increases nowadays, I don’t think there’s any, or if there is, it would be so slight that it’s unnoticeable.