Global/AddCSLuaFile

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Huzzah! Can't believe that worked. MediaWiki, you have disappointed me.)
(shared function note.)
Line 3: Line 3:
 
{{Note|The file path can be relative to the script it is ran from. For example, if your script is in lua/myfolder/stuff.lua, calling {{GlobalFunction|AddCSLuaFile}}("otherstuff.lua") and {{GlobalFunction|AddCSLuaFile}}("myfolder/otherstuff.lua") is the same thing.}}
 
{{Note|The file path can be relative to the script it is ran from. For example, if your script is in lua/myfolder/stuff.lua, calling {{GlobalFunction|AddCSLuaFile}}("otherstuff.lua") and {{GlobalFunction|AddCSLuaFile}}("myfolder/otherstuff.lua") is the same thing.}}
 
{{Note|If the file that is pointed to by the 'file' argument is empty, the function will return an error, and the marked file will not be sent to the client.}}
 
{{Note|If the file that is pointed to by the 'file' argument is empty, the function will return an error, and the marked file will not be sent to the client.}}
 +
{{Note|This is a shared function but it doesn't do anything on the client.}}
 
|Realm=Shared
 
|Realm=Shared
 
|IsClass=No
 
|IsClass=No

Revision as of 19:54, 26 August 2016

 AddCSLuaFile( )

Contents

Description

Marks a Lua file to be sent to clients when they join the server.

NOTE

The file path can be relative to the script it is 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.

NOTE

If the file that is pointed to by the 'file' argument is empty, the function will return an error, and the marked file will not be sent to the client.

NOTE

This is a shared function but it doesn't do anything on the client.

Arguments

string file=current file

The name/path (relative to the garrysmod/lua folder) to the Lua file that should be sent. If no parameter is specified, it sends the current file.

Examples

Example

Adds the cl_init.lua file in the "lua" folder to be downloaded by connecting clients.

AddCSLuaFile( "cl_init.lua" )


Examples

Example

Adds the current file to the list of files to be downloaded by clients.

AddCSLuaFile()


Personal tools
Navigation