Garry's Mod Wiki

Garry's Mod Wiki

  string File:Read( number length = nil )

Description

Reads the specified amount of chars and returns them as a binary string.

Arguments

1 number length = nil
Reads the specified amount of chars. If not set, will read the entire file.

Returns

1 string data

Example

Adapted from extensions/file.lua

function file.Read( filename, path ) if ( path == true ) then path = "GAME" end if ( path == nil || path == false ) then path = "DATA" end local f = file.Open( filename, "rb", path ) if ( !f ) then return end local str = f:Read( f:Size() ) f:Close() if ( !str ) then str = "" end return str end

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 four times a day. Edits and history are not available.

Last Parsed: Loading...