Garry's Mod Wiki

Revision Difference

Global_Variables#519440

<cat>Dev.Lua</cat> # GLOBAL TABLES ## GAMEMODE The table of the currently active gamemode, outside the gamemode files. ## GM Same as GAMEMODE, but only exists gamemode files. (gamemodes/<gamemodeName>/gamemode/*.lua) ## ENT Similar to GM, but for Scripted Entities. Exists only in the files defining the entity. (lua/entities/*.lua) ## SWEP Similar to ENT, but for Scripted Weapons. Exists only in the files defining the weapon. (lua/weapons/*.lua) ## EFFECT Similar to ENT, but for Scripted Effects. Exists only in the files defining the effect. (lua/effects/*.lua) ## _G This table contains all global objects, including itself. ## _MODULES Contains a list all modules loaded from /modules/. # NON CONSTANTS ## CLIENT This is true whenever the current script is executed on the client. ( client and menu states ) See <page>States</page>. ## CLIENT_DLL This is true whenever the current script is executed on the client state. See <page>States</page>. ## SERVER This is true whenever the current script is executed on the server state. See <page>States</page>. ## GAME_DLL This is true whenever the current script is executed on the server state. ## MENU_DLL This is true when the script is being executed in the menu state. See <page>States</page>. ## GAMEMODE_NAME Contains the name of the current active gamemode ## NULL Represents a non existent entity ## VERSION Returns the version number of GMod. ## VERSIONSTR Returns a nicely formatted version of GMod. ## BRANCH Returns the branch the game is running on. ## _VERSION Current Lua version. This returns "Lua 5.1" in GMod at the moment. ## g_ Shortcuts ``` Shortcut pointers to important clientside objects. Shortcut pointers to important clientside objects. ``` g_SkyPaint | The active `env_skypaint` entity. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/entities/entities/env_skypaint.lua#L131)) | -----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ! g_VoicePanelList | Base panel for displaying incoming/outgoing voice messages. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/cl_voice.lua#L135)) | ! g_SpawnMenu | Base panel for the spawn menu. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua#L207)) | Variable | Description | ---------|-------------| g_SkyPaint | The active *env_skypaint* entity. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/entities/entities/env_skypaint.lua#L131)) | g_ContextMenu | Base panel used for context menus. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/contextmenu.lua#L143)) | g_VoicePanelList | Base panel for displaying incoming/outgoing voice messages. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/cl_voice.lua#L135)) | g_SpawnMenu | Base panel for the spawn menu. ([View Source](https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/gamemode/spawnmenu/spawnmenu.lua#L207)) | # CONSTANTS ## MISC ``` vector_origin = Vector( 0, 0, 0 ) vector_up = Vector( 0, 0, 1 ) angle_zero = Angle( 0, 0, 0 ) color_white = Color( 255, 255, 255, 255 ) color_black = Color( 0, 0, 0, 255 ) color_transparent = Color( 255, 255, 255, 0 ) ``` ## ENUMS Almost all enumerations are globals. View them here View them [here](Enums)