Garry's Mod Wiki

Garry's Mod Wiki

  string File:ReadLine()

Description

Returns the contents of the file from the current position up until the end of the current line.

This function will look specifically for Line Feed characters \n and will completely ignore Carriage Return characters \r.
This function will not return more than 8192 characters. The return value will include the \n character.

Returns

1 string
The string of data from the read line.

Example

Open a file in read only mode, reads a line, tells where the current file pointer is at and then closes the file handle.

local f = file.Open( "cfg/mapcycle.txt", "r", "MOD" ) print( f:ReadLine() ) print( f:ReadLine() ) print( f:Tell() ) f:Close()
Output:
// Default mapcycle file for Garry's Mod. 45

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...