Garry's Mod Wiki

Revision Difference

file.Read#543821

<function name="Read" parent="file" type="libraryfunc"> <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.⤶ <warning>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.</warning>⤶ </description> <realm>Shared and Menu</realm> <file line="4-L19">lua/includes/extensions/file.lua</file> <args> <arg name="fileName" type="string">The name of the file.</arg> <arg name="gamePath" type="string">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</arg> </args> <rets> <ret name="" type="string">The data from the file as a string, or `nil` if the file isn't found</ret>⤶ <ret name="" type="string">The data from the file as a string, or `nil` if the file isn't found.</ret>⤶ </rets> </function> <example> <description>Prints out the content of `helloworld.txt`.</description> <code>print( file.Read( "helloworld.txt", "DATA" ) )</code> <output>This is the content!</output>⤶ <output>⤶ ```⤶ This is the content!⤶ ```⤶ </output>⤶ </example>