Garry's Mod Wiki

Revision Difference

Lua_Folder_Structure#523199

<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. > `autorun/` - A folder for automatic scripts load and include 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 >> `properties/` - A Folder for properties in <page>The Context Menu</page>. > `bin/` - A folder for external binary modules. (<page>Creating Binary Modules</page>) > `derma/` - A folder for <page>derma</page> utils. > `drive/` - A folder for <page>drive</page> system classes. > `effects/` - Scripts placed here will be automatically attempted to be loaded as Lua effects. (<page>util.Effect</page>) > `entities/` - Scripts placed here will be automatically attempted to be loaded as SENTs. (<page>Structures/ENT</page>) > `includes/` - A folder for Lua libraries and additional stuff used in other scripts. Runs first. >> `extensions/` - A folder for extended libraries. For example <page>table</page> library already exists but `extensions/table.lua` extends it. >> `modules/` - A folder for libraries. > `matproxy/` - A folder <page>matproxy</page> stuff. > `menu/` - A folder used for <page text="Menu state">States</page>. > `postprocess/` - Run by client on startup, typically contains Sandbox Post Processing effects. > `skins/` - A folder for users <page text="derma skins">Derma Skin Creation</page>. > `vgui/` - Clientside folder for UI panels. > `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>) `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. > `<gamemodename>/` - A folder containing gamemode files. >> `entities/` - Basically `lua/` folder that is only loaded when the gamemode is. Subfolders are exactly the same as mentioned above. >> `gamemode/` - Folder contains all gamemode files. `init.lua` and `cl_init.lua` __must__ exist in it.