What's the difference of using local and _G?
I just want to know the difference and when to use them.
✓ ANSWER ACCEPTED
What's the difference between local and _G?
2 answers
✓ Accepted answer
_G is a table that is shared across every script in a given environment (server separate from client separate from corescripts)
local is a keyword for defining variables in the local scope so that they cannot be accessed or changed outside of the block they are defined in.
_G --means global, a variable used for all scripts in the server
local --means it is a variable only used for one function
This discussion is preserved as it was. New answers, comments, and votes are closed.
