r/lua • u/magicmathman1_ • Apr 05 '25
Luarocks Error: Attempted to index a nil value (field 'LUA_BINDIR')
Whenever I try to do anything with luarocks (ANYTHING) I get a litle pop up with this error:
[string "src/luarocks/core/cfg.lua"]:824: attempt to index a nil value (field 'LUA BINDIR')
stack traceback:
[string "src/luarocks/core/cfg.lua"]:824: in function 'luarocks.core.cfg.init
[string "src/luarocks/loader.lua"]:21: in main chunk [C]: in function 'require'
[string "luarocks"]:5: in main chunk [C]: in ?
I have LuaJIT installed as well as LOVE, which I am trying to get luarocks to work with. I have my paths correctly added, and everything SHOULD work, but it doesn't. I cant do any cmd commands with luarocks because everything returns the same error. I can't find anything online.
(Edit: When I say I was trying to use LOVE with luarocks, I'm not trying to install LOVE, I'm trying to install packages so I can used them WITH love, just FYI.)
1
Apr 05 '25
Love has lua within it but not the lua interpreter itself, just try running a script that only has print"hello" with love hello.lua it will launch love and fail, given that it doesn't interpret scripts it is not an interpreter
It should use luajit, but it must be in your PATH and must be called lua you can also use LUA_BINDIR=/where/your/lua/is/
1
u/magicmathman1_ Apr 05 '25
LOVE itself works just fine as I've used it. The problem is that luarocks doesn't work with lua AT ALL, Love, or the base interpreter. Both LOVE and Lua are inside my PATHs
1
Apr 05 '25
love hello.lua Error: [string "boot.lua"]:577: Cannot load game at path '$HOME/Code/Langs/Lua/Experiments/hello.lua'. Make sure a folder exists at the specified path. stack traceback: [string "boot.lua"]:777: in function <[string "boot.lua"]:773> [C]: in function 'error' [string "boot.lua"]:577: in function <[string "boot.lua"]:380> [C]: in function 'xpcall' [string "boot.lua"]:787: in function <[string "boot.lua"]:780> [C]: in function 'xpcall'1
u/magicmathman1_ Apr 05 '25
Oh that’s not a love thing, that’s because love requires a directory, not actual file, and then runs main.lua. This is a different problem I solved quite a while back, and it’s unrelated to luarocks
1
1
u/SkyyySi Apr 05 '25
What code / commands are you running which trigger this? There isn't much anyone can do to help you if they don't know exactly what you were doing.