AddCSLuaFile
Description
Marks a Lua file to be sent to clients when they join the server. Doesn't do anything on the client - this means you can use it in a shared file without problems.
The string cannot have whitespace.
lua/matproxy/
lua/postprocess/
lua/vgui/
lua/skins/
lua/autorun/
lua/autorun/client/
You can add up to 8192 files. Each file can be up to 64KB compressed (LZMA)
Arguments
The file path can be relative to the script it's ran from. For example, if your script is in lua/myfolder/stuff.lua
, calling AddCSLuaFile("otherstuff.lua") and AddCSLuaFile("myfolder/otherstuff.lua") is the same thing.
lua/config.lua
in your addon may be overwritten by the same file in another addon.Example
Adds the cl_init.lua file in the lua
folder to be downloaded by connecting clients. This is required, and is normally done in init.lua.
Example
Adds the current file to the list of files to be downloaded by clients. This is usually done at the top of a shared file.
Example
Allows to send a clientside script when a user joins the server. This kind of code can be found in some addons which load scripts to a custom folder to prevent conflicts between others files.
Example
Specify a base folder and recursively include cl, sh and sv files without having to specify them.