Garry's Mod Wiki

Revision Difference

Lua_Folder_Structure#523188

<cat>Dev.GettingStarted</cat> The structure of the Lua folder can be confusing. This page tries to layout where script files should go. If a folder is not mentioned here, you should not put your scripts into it unless you know what you are doing. ⤶ > `lua/` (Same as `addons/<addonName>/lua/`) ⤶ >> `autorun/` - all files are automatically loaded on Lua start, both clientside and serverside. ⤶ >>> `client/` - Clientside only autorun scripts. ⤶ >>> `server/` - Serverside only scripts. ⤶ >> `postprocess/` - Run by client on startup, typically contains Sandbox Post Processing effects ⤶ >> `skins/` - Derma skins ⤶ >> `drive/` - <page>drive</page> system classes ⤶ >> `matproxy/` - <page>matproxy</page> stuff ⤶ >> `weapons/` - Scripts placed here will be automatically attempted to be loaded as weapons (<page>Structures/SWEP</page>) ⤶ >>> `gmod_tool/stools/` - (Sandbox only) Scripts placed here will be automatically attempted to be loaded as tools (<page>Structures/TOOL</page>) ⤶ >> `entities/` - Scripts placed here will be automatically attempted to be loaded as SENTs (<page>Structures/ENT</page>) ⤶ >> `effects/` - Scripts placed here will be automatically attempted to be loaded as Lua effects (<page>util.Effect</page>) ⤶ >> `vgui/` - Clientside folder for UI panels ⤶ > `gamemodes/`⤶ ⤶ >> `<gamemodename>/` - A folder containing gamemode files ⤶ >>> `gamemode/` - Folder contains all gamemode files. `init.lua` and `cl_init.lua` __must__ exist in it. ⤶ >>> `entities/` - Basically Lua folder that is only loaded when the gamemode is. Subfolders are exactly the same as mentioned above. ⤶ `lua/` (Same as `addons/<addonName>/lua/`) ⤶ > `autorun/` - all files are automatically loaded on Lua start, both clientside and serverside. ⤶ >> `client/` - Clientside only autorun scripts. ⤶ >> `server/` - Serverside only scripts. ⤶ > `postprocess/` - Run by client on startup, typically contains Sandbox Post Processing effects ⤶ > `skins/` - Derma skins ⤶ > `drive/` - <page>drive</page> system classes ⤶ > `matproxy/` - <page>matproxy</page> stuff ⤶ > `weapons/` - Scripts placed here will be automatically attempted to be loaded as weapons (<page>Structures/SWEP</page>) ⤶ >> `gmod_tool/stools/` - (Sandbox only) Scripts placed here will be automatically attempted to be loaded as tools (<page>Structures/TOOL</page>) ⤶ > `entities/` - Scripts placed here will be automatically attempted to be loaded as SENTs (<page>Structures/ENT</page>) ⤶ > `effects/` - Scripts placed here will be automatically attempted to be loaded as Lua effects (<page>util.Effect</page>) ⤶ > `vgui/` - Clientside folder for UI panels ⤶ `gamemodes/`⤶ ⤶ > `<gamemodename>/` - A folder containing gamemode files ⤶ >> `gamemode/` - Folder contains all gamemode files. `init.lua` and `cl_init.lua` __must__ exist in it. ⤶ >> `entities/` - Basically Lua folder that is only loaded when the gamemode is. Subfolders are exactly the same as mentioned above.