Luacheck module

luacheck module is a single function. Use local luacheck = require "luacheck" to import it.

The first argument of the function should be an array. Each element should be either a file name (string) or an open file handle, in which case luacheck will read it till EOF and close it.

The second argument, if present, should be a table of options. See Config options.

When checking n-th file, luacheck will try to combine options[n] and entries from its array part with general options, similarly to how per file config tables overwrite main config table.

Report format

The luacheck function returns a report. A report is an array of file reports plus fields warnings and errors containing total number of warnings and errors, correspondingly.

A file report is an array of warnings. If an error occured while checking a file, its report will only have error field containing "I/O" or "syntax".

A warning is a table with field code indicating the type of warning (see List of warnings), and fields line and column pointing to the source of the warning. For warnings related to redefined variables there also are fields prev_line and prev_column pointing to the previous declaration of the variable.