Garry's Mod Wiki

Revision Difference

file.Write#518418

<function name="Write" parent="file" type="libraryfunc"> <description>Writes the given string to a file. Erases all previous data in the file. To add data without deleting previous data, use <page>file.Append</page>.</description> <realm>Shared and Menu</realm> <file line="21">lua/includes/extensions/file.lua</file> <args> <arg name="fileName" type="string">The name of the file being written into. The path is relative to the **data/** folder.&#xA;&#xA;This argument will be forced lowercase.&#xA;&#xA;The filename **must** end with one of the following:&#xA;* .txt&#xA;* .jpg&#xA;* .png&#xA;* .vtf&#xA;* .dat&#xA;* .json&#xA;&#xA;&#xA;Restricted symbols are: &amp;amp;lt;pre class=&quot;inline&quot;&amp;amp;gt;&quot; :&amp;amp;lt;/pre&amp;amp;gt;</arg>⤶ <arg name="fileName" type="string">The name of the file being written into. The path is relative to the **data/** folder.⤶ This argument will be forced lowercase.⤶ ⤶ The filename **must** end with one of the following:⤶ * .txt⤶ * .jpg⤶ * .png⤶ * .vtf⤶ * .dat⤶ * .json⤶ ⤶ ⤶ Restricted symbols are: &amp;lt;pre class="inline"&amp;gt;" :&amp;lt;/pre&amp;gt;</arg>⤶ <arg name="content" type="string">The content that will be written into the file.</arg> </args> </function> <example> <description>Writes to **data/helloworld.txt**.</description> <code>file.Write( "helloworld.txt", "This is the content!" )</code> </example>