How to set Lua file load path in defold?

how to set lua file load path in defold? can I set lua file load path by use package.path or package.cpath?

We replace the standard loaders with our own loader:

This loader explicitly loads files from within the game archive. Our build pipeline also inspects all script files and picks up all calls to require() to detect which Lua modules to include. This is good because we only include Lua files which are actually used, but it is bad since it doesn’t really allow you to load other Lua files using require() without also tripping up our build pipeline.

You can of course add your own loaders to package.loaders but then you also need to fool our build pipeline.

Another thing to consider is compatibility between platforms. You will not be able to require() Lua files from anywhere on all platforms.

So I guess before we go on I’d like to know more about what it is you wish to achieve?

1 Like