Revision Difference
Lua_Folder_Structure#520000
<removed>This article contains outdated/incorrect information.</removed>⤶
⤶
The structure of the Lua folder can be confusing. Here's a rundown:⤶
<ul><li> **lua**⤶
<ul><li> **autorun** - all files are automatically loaded on Lua start.
<ul><li> **client** - autorun client scripts.
</li><li> **server** - autorun server scripts.
</li><li> **shared** - autorun shared (both cl_ and sv_) scripts.
</li></ul>⤶
</li><li> **includes** - init.lua loaded on start.⤶
<ul><li> **enum** - Loaded on start. Contains all enum files.⤶
</li><li> **extensions** - Loaded on start. Extends existing libraries and types.⤶
</li><li> **modules** - Contains all modules.
</li></ul>⤶
</li><li> _**downloaded** - Clientside downloaded files⤶
<ul><li> **.cache** - Contains cached versions of all downloaded files (to prevent constantly redownloading)⤶
</li></ul>⤶
</li><li> **postprocess** - Run by client on startup⤶
</li></ul>⤶
⤶
----⤶
⤶
</li><li> **gamemodes** - Contains gamemodes. Gamemodes are only run when they're required (either by the map setting the gamemode or by another gamemode being derived from that gamemode).
<ul><li> **base** - Entities in this folder exist in every Gamemode⤶
<ul><li> **entities** - All scripted items come under this directory.⤶
<ul><li> **weapons** - Scripted Weapons⤶
</li><li> **entities** - Scripted Entities⤶
</li><li> **effects** - Scripted Effects⤶
</li></ul>⤶
</li><li> **gamemode** - All Gamemode scripts go in here.⤶
</li></ul>⤶
</li><li> **other gamemodes**⤶
<ul><li> **entities** - All scripted items come under this directory.⤶
<ul><li> **weapons** - Scripted Weapons⤶
</li><li> **entities** - Scripted Entities⤶
</li><li> **effects** - Scripted Effects⤶
</li></ul>⤶
</li><li> **gamemode** - All Gamemode scripts go in here.⤶
</li></ul>⤶
</li></ul>⤶
</li></ul>⤶
⤶
`Source: [GMod Wiki](https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index66fb-2.html)`<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 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>)
- 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.⤶