Revision Difference
Lua_Loading_Order#561265
<cat>Dev.GettingStarted</cat>
This list shows the order of loading Lua files in Garry's Mod.
<note>GMod filesystem combines all scripts into one folder. `addon/myaddon/lua/entities/` and `gamemodes/base/gamemode/entities/entities/` will be merged with `lua/entities/`.</note>
<note>GMod combines all scripts into a virtual filesystem (one folder). `addon/myaddon/lua/entities/` and `gamemodes/base/gamemode/entities/entities/` will be merged with `lua/entities/`, so therefore the same path and name will override and/or conflict.</note>
<note>Lua files are sorted alphabetically(A-Z) on all OSes before being executed</note>⤶
# Client loading order
- `includes/init.lua` - Everything from `includes/` is included from this file
- `derma/init.lua` - Everything from `derma/` is included from this file
- `gamemodes/base/gamemode/cl_init.lua` - Everything from `gamemodes/base/gamemode/` is included from this file
- `autorun/` - Ascending order (Descending on Linux)
- `autorun/client/` - Ascending order (Descending on Linux)
- `postprocess/` - Ascending order (Descending on Linux)
- `vgui/` - Ascending order (Descending on Linux)
- `matproxy/` - Ascending order (Descending on Linux)
- `skins/default.lua`
- `gamemodes/*gamemodename*/gamemode/cl_init.lua` - Everything from `gamemodes/*gamemodename*/gamemode/` is included from this file
- `weapons/` - Ascending order (Descending on Linux)
- `weapons/gmod_tool/stools/` - Ascending order (Descending on Linux)
- `entities/` - Ascending order (Descending on Linux)
- `effects/` - Ascending order (Descending on Linux)
# Server loading order
- `includes/init.lua` - Everything from `includes/` is included from this file
- `gamemodes/base/gamemode/init.lua` - Everything from `gamemodes/base/gamemode/` is included from this file
- `autorun/` - Ascending order (Descending on Linux)
- `autorun/server/` - Ascending order (Descending on Linux)
- `autorun/server/sensorbones` - Ascending order (Descending on Linux)
- `includes/dev_server_test.lua` - Only executed if the `-systemtest` command line parameters were added.
- `gamemodes/*gamemodename*/gamemode/init.lua` - Everything from `gamemodes/*gamemodename*/gamemode/` is included from this file
- `weapons/` - Ascending order (Descending on Linux)
- `weapons/gmod_tool/stools/` - Ascending order (Descending on Linux)
- `entities/` - Ascending order (Descending on Linux)
- `effects/` - Ascending order (Descending on Linux)