2

When I run luarocks init in a directory that has a rockspec file, the tree in lua_modules/share/lua/5.1 for my project isn't added to the project.path of the generated ./lua wrapper so modules installed with luarocks aren't resolved in my source code.

I have to either do eval "$(./luarocks path)" or manually add ./lua_modules/share/lua/5.1/?.lua to the package.path of the ./lua wrapper that's generated by the luarocks init command.

Is this normal expected behavior or is the project's tree suppose to be added to the generated ./lua wrapper package.path automatically? I'd expect the latter behavior to be the default expected behavior as you'd want a project's dependencies to be available to it.

I'm guessing that maybe the expected behavior is having to add the project's tree to the path after the fact is normal, I'm missing something when I run the luarocks init command to specify to include the project's tree, or I'm missing something from my rockspeck file possibly?

I'm new to lua and LuaRocks so apologies if I'm getting some terminology wrong and/or it's a skill issue of not understanding how things work (which I imagine is probably the case).

Luarocks version: /usr/bin/luarocks 3.8.0

My luarocks configuration:


Configuration:
   Lua:
      Version    : 5.1
      Interpreter: /usr/bin/lua5.1 (ok)
      LUA_DIR    : /usr (ok)
      LUA_BINDIR : /usr/bin (ok)
      LUA_INCDIR : /usr/include/lua5.1 (ok)
      LUA_LIBDIR : /usr/lib/x86_64-linux-gnu (ok)

   Configuration files:
      System  : /etc/luarocks/config-5.1.lua (ok)
      User    : /home/user/.luarocks/config-5.1.lua (not found)

   Rocks trees in use:
      /home/user/.luarocks
      /usr/local

The rockspec file for my project:

package = "project"
version = "dev-1"
source = {
   url = "https://github.com/me/project"
}
description = {
   homepage = "https://github.com/me/project",
   license = "MIT",
   summary = "My project summary.",
   maintainer = "me <[email protected]>",
}
build = {
   type = "builtin",
   modules = {
      main = "src/main.lua"
   }
}
dependencies = {
   "lua ~> 5.1"
}

1 Answer 1

3

This issue was fixed in version 3.10.0

Sign up to request clarification or add additional context in comments.

1 Comment

Well then, looks like I might need to update some of my apt repo keys (hopefully they have one for the most up to date stable version otherwise I guess I'll manually update). Thanks for the info!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.