How do you use _G and _VERSION/the difference between the two? i’ve read some info on lua.org and the Developer Hub so I somewhat know what it is and what they’re for. I just want to know how they’re used and when to use them.
It’s said ModuleScript are better to use instead of global variables, but anyways global variables can be accessed from any script type it was created from. Example:
--<first Script
_G.RenderQuality = 3;
--<second Script
print(_G.RenderQuality) --3
A Problem that can arise from this is that the first script gets executed after second script, so _G.RenderQuality
in the second script will be nil
You can’t use _G
across different script types I think (I don’t know how to properly call it). I mean, if _G.RenderQuality
was set on the server, it can’t be accessed locally.
and _VERSION
is just the current version of lua?
2 Likes
interesting, i must’ve misread what i saw.