Garry's Mod Wiki

file.Read

string file.Read( string fileName, string gamePath )

Description

Returns the content of a file.

Beware of casing -- some filesystems are case-sensitive. SRCDS on Linux seems to force file/directory creation to lowercase, but will not modify read operations.

Arguments

1 string fileName
The name of the file.
2 string gamePath
The path to look for the files and directories in. See this list for a list of valid paths.

Returns

1 string
The data from the file as a string, or nil if the file isn't found

Example

Prints out the content of helloworld.txt.

print( file.Read( "helloworld.txt", "DATA" ) )
Output: This is the content!

Page Links


Special Pages


Wikis

?

Render Time: 79ms

DB GetPage 17
Generate Html 4
SaveChanges (1) 42
Render Body 0
Render Sidebar 13