Skip to content

file.open

JoeStrout edited this page Apr 29, 2026 · 2 revisions

Open a file; returns a FileHandle, or null on failure

Parameters

Parameter Default Value Note
path
mode "r+"

Return value

Condition Return Value
(always) number

Notes

Example

import "file"
fh = file.open("data.txt", "r")
if fh == null then
    print "failed to open file"
else
    while not fh.atEnd
        print fh.readLine
    end while
    fh.close
end if

Clone this wiki locally