Garry's Mod Wiki
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 default endianness is little-endian. To use big-endian you will need to provide your own functions to read and write shorts and longs.
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.
File:Flush()
Dumps the file changes to disk and saves the file.
Reads the specified amount of chars and returns them as a binary string.
number File:ReadDouble()
Reads an 8-byte little-endian IEEE-754 floating point double from the file.
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.
string File:ReadUInt64()
Reads an unsigned 64-bit integer from the file.
number File:ReadUShort()
Reads an unsigned little-endian 16-bit integer from 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:WriteShort( number int16 )
Writes a signed little-endian 16-bit integer to the file.
File:WriteUInt64( string uint64 )
Writes an unsigned 64-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.
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...