castl
castl copied to clipboard
Emulate node's require
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.
Might be able to work from the actual node implementation? https://github.com/nodejs/node/blob/master/lib/module.js