Garry's Mod Wiki

File

File

You might be looking for the "file" Library, which has the same name as this class.

This is the file object. It used used primarily to read or write binary data from files.

The object is returned by file.Open.

Methods

File:Close()
Dumps the file changes to disk and closes the file handle which makes the handle useless.
boolean File:EndOfFile()
Returns whether the File object has reached the end of file or not.
File:Flush()
Dumps the file changes to disk and saves the file.
string File:Read( number length )
Reads the specified amount of chars and returns them as a binary string.
boolean File:ReadBool()
Reads one byte of the file and returns whether that byte was not 0.
number File:ReadByte()
Reads one unsigned 8-bit integer from the file.
number File:ReadDouble()
Reads an 8-byte little-endian IEEE-754 floating point double from the file.
number File:ReadFloat()
Reads an IEEE 754 little-endian 4-byte float from the file.
string File:ReadLine()
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.
number File:ReadLong()
Reads a signed little-endian 32-bit integer from the file.
number File:ReadShort()
Reads a signed little-endian 16-bit integer from the file.
number File:ReadULong()
Reads an unsigned little-endian 32-bit integer from the file.
number File:ReadUShort()
Reads an unsigned little-endian 16-bit integer from the file.
File:Seek( number pos )
Sets the file pointer to the specified position.
number File:Size()
Returns the size of the file in bytes.
number File:Skip( number amount )
Moves the file pointer by the specified amount of chars.
number File:Tell()
Returns the current position of the file pointer.
File:Write( string data )
Writes the given string into the file.
File:WriteBool( boolean bool )
Writes a boolean value to the file as one byte.
File:WriteByte( number uint8 )
Write an 8-bit unsigned integer to the file.
File:WriteDouble( number double )
Writes an 8-byte little-endian IEEE-754 floating point double to the file.
File:WriteFloat( number float )
Writes an IEEE 754 little-endian 4-byte float to the file.
File:WriteLong( number int32 )
Writes a signed little-endian 32-bit integer to the file.
File:WriteShort( number int16 )
Writes a signed little-endian 16-bit integer to the file.
File:WriteULong( number uint32 )
Writes an unsigned little-endian 32-bit integer to the file.
File:WriteUShort( number uint16 )
Writes an unsigned little-endian 16-bit integer to the file.

Special Pages


Wikis

?

Render Time: 53ms

DB GetPage 36
Generate Html 3
SaveChanges (1) 6
Render Body 0
Render Sidebar 6