castl icon indicating copy to clipboard operation
castl copied to clipboard

Emulate node's require

Open daurnimator opened this issue 7 years ago • 1 comments

It would be nice to be able to have lua load node.js modules on the fly. i.e. runtime:require("../foo.js").

  • It should take care of relative paths etc.
  • It should create the node.js module object
  • It should interpret package.json to find the 'main' module.

daurnimator avatar Mar 27 '17 08:03 daurnimator

Might be able to work from the actual node implementation? https://github.com/nodejs/node/blob/master/lib/module.js

daurnimator avatar Mar 28 '17 04:03 daurnimator