cc.require

This provides a pure Lua implementation of the builtin require function and package library.

Generally you do not need to use this module - it is injected into the every program's environment. However, it may be useful when building a custom shell or when running programs yourself.

Usage

make(env, dir)Build an implementation of Lua's package library, and a require function to load modules within it.
make(env, dir)Source

Build an implementation of Lua's package library, and a require function to load modules within it.

Parameters

  1. env table The environment to load packages into.
  2. dir string The directory that relative packages are loaded from.

Returns

  1. function The new require function.
  2. table The new package library.