Garry's Mod Wiki


  number file.AsyncRead( string fileName, string gamePath, function callback, boolean sync = false )


Returns the content of a file asynchronously.

All limitations of file.Read also apply.

This function is currently broken in the Menu State and won't be fixed. Bug Report


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.
3 function callback
A callback function that will be called when the file read operation finishes. Arguments are:
  • string fileName - The fileName argument above.
  • string gamePath - The gamePath argument above.
  • number status - The status of the operation. The list can be found in FSASYNC enum.
  • string data - The entirety of the data of the file.
4 boolean sync = false
If true the file will be read synchronously.


1 number status
FSASYNC_OK on success, FSASYNC_ERR_ on failure.


Prints the SteamIDs of players who will be automatically assigned to a user group when they connect to a server (Sandbox gamemode and derived).

file.AsyncRead( "settings/users.txt", "GAME", function( fileName, gamePath, status, data ) if ( status == FSASYNC_OK ) then PrintTable( util.KeyValuesToTable( data ) ) end end)
admin: garry = STEAM_0:1:7099 superadmin: garry = STEAM_0:1:7099