file.close

Syntax

b = file.close(<f>)

Close a file. The most recently opened file is closed if no arguments are provided.

Returns:

b - true if a file was closed.

Arguments:

f - optional file pointer

Usage Example

The following example illustrates how file.close can be used

model new
zone create brick size 2 2 2
fish define output_gps
    local f = file.open("gps.txt","write","text")
    local l = list
    loop foreach local g gp.list
        local a = string.build("%1,%2,%3,%4", gp.id(g), ...
                       gp.pos(g)->x, gp.pos(g)->y, gp.pos(g)->z)
        l = list.append(l,a)
    endloop
    file.write(f,l)
    file.close(f)
end
[output_gps]