dofile

Name

dofile – load and execute a Lua file

Synopsis

result = dofile(filename)

Description

This looks for the given filename in the current directory (i.e. the directory containing the currently executing Lua script). If it is not found, then the file is looked for in the "root" directory of the current package instead.

Assuming the file is found, it is then loaded and executed as a Lua chunk.

Return Value

dofile returns any value(s) that are returned by the loaded chunk.

Errors

If the given file is not found, an error is raised.

If the loaded chunk raises any errors, then these errors are propagated by the dofile call.

See Also

require