How to install packages to Lua project?

Question:
How to install Lua package ‘socket’ to Lua project? I can’t find any solution.

Hi @EmilAhmaBoy!
Uou’ll need to use luarocks to install packages.
Try entering luarocks install luasocket in the Shell.
Taken from:

Hope this helps!

1 Like

I already installed the luarocks.


For the Nix packages, were the packages installed automatically or did you fo it yourself?

Through wget https://luarocks.org/releases/luarocks-3.9.2.tar.gz and tar zxpf luarocks-3.9.2.tar.gz

So these were added to replit.nix by yourself?

Sorry, I don’t understand what is replit.nix.

So… I think I already have this file

Can you try running luarocks install luasocket --local?

1 Like

Wow, thanks, it works

But it still doesn’t find it. Is there a way to force Lua for finding file in the folder .luarocks?

Hi @EmilAhmaBoy!
Could you post the link to your repl?
Thanks!

https://replit.com/@EmilAhmaBoy/Server

Hm, I’ve tried removing the package, re-addding it, or deleting the folder and installing again, nothing seems to work.
Maybe someone else can help here?

try forking the repl project making a new one, maybe that would work?

No, it’s a directory and Nix problem… I don’t think forking helps (it duplicates everything).

1 Like

yeah idk i tried to help at this point

Then… Is this impossible?

Just had a series of thoughts on this, could you go to your Repl and install it again? After that, run mv ~/.luarocks ./.luarocks, and see if it works then

Did you reinstall the package first? ( luarocks install luasocket --local)