简体   繁体   中英

How to install Lua libraries on separate folder

Hello i would like to change folder that luasocket is installing to how can i do that ? My plan is at the end i want to export my lua file as exe and use it to run my server. I want to put luasocket inside Project file so other windows computer wont have problems (I am using Windows computer too). Thanks for helping.

my code

Main.lua

lpackage.path = package.path..';./libs/lua/?.lua'
package.cpath = package.cpath..';./libs/socket/?.dll;'

This is my Project tree
Project
-libs
--lua

Assuming you keep the name of the luasocket DLL the same (which is usually, core.dll ), you need to use ./libs/?.dll instead of ./libs/socket/?.dll , as the question mark will be replaced with socket/core when socket.core module is required from socket.lua . You'll need to put core.dll in libs/socket folder.

You will also need to have lua.dll present (as the core.dll is usually compiled against it) or use a proxy dll if your executable statically compiles lua interpreter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM