node package manager



npm npm

Implements node's require.resolve module resolution pattern for Lua.

This allows you to install Lua packages from npm and require them like normal modules.

All of the features of npm will come with using this pattern.

  • Semantic Versioning of modules
  • Modules installed locally, not globally
  • Manage installed modules in a package.json file
  • npm scripts
  • Tons more


npm uses this pattern when it installs modules. So let's use npm! installing npm

In your project directory, we need to install node-resolve-lua:

$ npm install node-resolve-lua
--Only needs to be done once

And that's it! You're ready to include modules from npm now.

Example Usage

If we wanted to use a module from npm such as luadash, we would do this:

$ npm install luadash
local __ = require("luadash")
function double (value)
  return value * 2
end, {1, 2, 3}) -- => {2, 4, 6}