• Garry's Mod Lua Variable Naming Convention Question
    3 replies, posted
What is the specific reason that variables like GAMEMODE, ENT, SWEP, EFFECT, and PANEL are all-caps? In other languages all-caps variables usually mean constants that will never be changed or modified, but these are variables that are usually modified.
I think it's because they're all [URL="https://wiki.garrysmod.com/page/Category:Hooks"]hooks[/URL]. Yes, they're usually overwritten, but they're not ever removed since they're important toward the game's functioning, so in a way they're like constants. Actually, they can be removed, as can variables. Nevermind
This isn't really tied to a specific naming convention to my knowledge. I believe it's related to the fact that these are tables provided to the scope of the file and making them all caps shows their uniqueness to that environment.
Those are all made in the engine except PANEL, which can be anything because you have to create it yourself, but it's PANEL just to keep to the convention. In lua, variables related to the environment are usually in all caps, with special lua-made variables being prefixed with an underscore (_G, _ENV, _VERSION). [url]http://wiki.garrysmod.com/page/Global_Variables[/url]
Sorry, you need to Log In to post a reply to this thread.