Garry's Mod Wiki

Revision Difference

Lua_Folder_Structure#554516

<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/` - A folder for automatic scripts load and include on Lua start, both clientside and serverside. >> `client/` - Clientside only autorun scripts. >> `server/` - Serverside only scripts. >> `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 for <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. >> `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. `models/` > `sound/` > `resource/` > `<fonts>/` - <page>surface.CreateFont</page> > `<localization>/` <page>Addon Localization</page> `particles/` <page>game.AddParticles</page> > `materials/` <page>Materials and Textures</page>