File/Read

From Garry's Mod
Jump to: navigation, search
 File:Read( )

Contents

Description

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

Arguments

number length

Reads the specified amount of chars.

Returns

string

data

Examples

Example

Adapted from extensions/file.lua

function file.Read( filename, path )
	if ( path == true ) then path = "GAME" end
	if ( path == nil or path == false ) then path = "DATA" end

	local f = file.Open( filename, "r", path )
	if ( !f ) then return end
	local str = f:Read( f:Size() )
	f:Close()
	return str or ""
end


Personal tools
Navigation