LuaCov Reference

# Module `luacov.util`

Utility module.

## Functions

unprefix (str, prefix) | Removes a prefix from a string if it's present.
load_string (str[, env[, chunkname]]) | Loads a string.
load_config (name, env) | Load a config file.
file_exists (name) | Checks if a file exists.

## Functions

unprefix (str, prefix)
  Removes a prefix from a string if it's present.

  ### Parameters:

  - str a string.
  - prefix a prefix string.

  ### Returns:

  original string if does not start with prefix or string without prefix.
load_string (str[, env[, chunkname]])
  Loads a string.

  ### Parameters:

  - str a string.
  - env environment table. (optional)
  - chunkname chunk name. (optional)
load_config (name, env)
  Load a config file. Reads, loads and runs a Lua file in an environment.

  ### Parameters:

  - name file name.
  - env environment table.

  ### Returns:

  true and the first return value of config on success, nil + error type + error message on failure, where error type can be "read", "load" or "run".
file_exists (name)
  Checks if a file exists.

  ### Parameters:

  - name file name.

  ### Returns:

  true if file can be opened, false otherwise.

generated by LDoc 1.5.0 Last updated 2024-12-04 15:36:32