Eyeon:Script/Reference/Libraries/io/write

From VFXPedia

Jump to: navigation, search

Contents

IO : fh : write / io.write

Arguments

fh:write( value, ... )

  • value (required, string or number)

One or more values to be written to the default output.

Returns

Returns nil if the function fails, or a non nil value if it succeeds.

Remarks

The io.write() (and fh:write) function writes the arguments passed to it as values to the file in filehandle 'fh'. It returns nil if it fails to write the arguments to the output. The arguments must be either a string or number, use the tostring() and tonumber() functions to convert other types of values.

Multiple values can be provided to this function by separating the values with a comma. No spaces or newlines are entered by this command. If you enter the command io.write("Hello", "There") or write("Hello"); io.write("There") the output will be HelloThere.

Requirements

  • eyeonScript 5.0
  • Fusion 5.0

Examples

-- function
-- a basic function which copies the file 
-- source to a new file named dest
-- this is an example function only, 
-- it does no error checking at all
 
 
function copyfile(src_path, dest_path)
 src = io.open(src_path, "rb")
 dest = io.open(dest_path,"wb")
 
 bytes = src:read(65536)
 
 repeat
 
 ret = dest:write(bytes)
 
 bytes = src:read(65536)
 
 until bytes == nil
 
 src:close()
 
 dest:close()
 
end
 
copyfile(src, dest)


Tips for write (edit)

EyeonTips:Script/Reference/Libraries/io/write