lua-users home
lua-l archive

Re: cannot locate the package socket

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am trying to create a lua socket. when i run the
program i find the error: "Cannot find the package
socket"
Have a look at the "installation.html" file in the doc directory of the LuaSocket distribution. It explains what you need where. On Windows I'd suggest KISS - try setting your LUA_CPATH and LUA_PATH to the same directory, e.g.
C:\Program Files\OPPR\Packages
Then place the following LuaSocket files in this directory, which is the "root" of all installed packages:
socket.lua
mime.lua
ltn12.lua
compat-5.1.lua
Create a subdirectory socket and place the following in it:
socket\core.dll
socket\http.lua
socket\tp.lua
socket\ftp.lua
socket\smtp.lua
socket\url.lua
And a subdirectory mime containing:
mime\core.dll
Consider how the packaging works -- the instruction to:
require "socket"
will look in LUA_PATH to find "socket.lua". This in turn requires "socket.core", which looks for core.dll in LUA_CPATH\socket (the dot in the name of the item to be required becomes a subdirectory in the layout of the package files on disk). If you want to add other packages, their top-level files (.lua or .dll) go into C:\Program Files\OPPR\Packages and any subfiles into the appropriate subdirectory. Many packages are self-contained, so there's just a .dll (or a .lua) file to place in C:\Program Files\OPPR\Packages.

AltStyle によって変換されたページ (->オリジナル) /