Garry's Mod Wiki


file.Write( string fileName, string content )


Writes the given string to a file. Erases all previous data in the file. To add data without deleting previous data, use file.Append.


1 string fileName
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
  • .vmt

Restricted symbols are: " :

2 string content
The content that will be written into the file.


Writes to data/helloworld.txt.

file.Write( "helloworld.txt", "This is the content!" )

Page Links

Special Pages



Render Time: 114ms

DB GetPage 13
Generate Html 3
SaveChanges (1) 78
Render Body 0
Render Sidebar 11