What's the difference? What can I do with shared
that I can't do with _G
?
There is no difference between shared
and _G
, they are, effectively, the exact same thing in two separate Tables.
shared
is a byproduct of a security update that happened to _G
which caused it to be removed for a few weeks. Basically, you didn't need to add a '_G' prefix to access its members before, and you did after. So shared
was created to rectify this, and then a little later we got _G
back, but not before a lot of people had already converted.
But like BlueTaslem said, both _G
and shared
are unnecessary and should be avoided as much as possible!
You can use _G. _G is a easier way to share values and probably player money to other scripts. It is a faster way.
_G.String = "on_and_on"
You can also print the string in another script: print(_G.String)