MTA:Eir/FileSystem/file/isWritable
From Multi Theft Auto: Wiki
This function returns whether a stream is writable. If a stream is not writable, then all write operations should result in nil operations (they will return zero bytes written). This state should be immutable across the lifetime of a file/stream class.
Syntax
boolean file.isWritable ()
Returns
Returns true if the file/stream is writable, false otherwise.
Example
Click to collapse [-]
ClientThis snippet implements a file function that makes sure the file it has been passed to for writing actually supports writing.
local function writeHeader( theFile, headerInfo ) -- Check whether we can write things into the file. if not ( theFile.isWritable() ) then error( "fatal error: stream is not writable" ); end -- Write a generic header structure. theFile.writeUInt( headerInfo.chunkSize ); theFile.writeFloat( headerInfo.version ); theFile.writeBoolean( headerInfo.isRaw ); end