Reference http://94it.net/a/jingxuanboke/2013/0625/49052.html
1.
I'm using a luaforwindows_v5.1.4-46.exe.
can be downloaded in my Baidu network disk,
Http://pan.baidu.com/s/1nt4yYCD
I installed it in the C:\Program files\lua\5.1
2, I downloaded on the official website Luasocket-2.0.2-lua-5.1.2-win32-vc8 http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2
Copy the Mime,socket folder in Luasocket-2.0.2-lua-5.1.2-win32-vc8 to C:\Program files\lua\5.1 (and the Lua folder in the same directory)
3, open SciTE, test require ("socket") whether error
Local ScriptPath = "C:\\Program files\\lua\\5.1\\"--getscriptdirectory () Local lua_cpath1 = ScriptPath ... "?. DLL "--Path setting is certain if this is set, otherwise there will be an error, or find" Socket.core "error local lua_path1 = ScriptPath ..." Lua\\?. Lua; ". ScriptPath. " Lua\\socket\\?. Lua "Package.path = Package.path"; ".. Lua_path1package.cpath = Package.cpath: ";".. Lua_cpath1print (lua_cpath1) print (lua_path1) require ("socket") local socket = require ("socket") Local host = " www.baidu.com "Local file ="/"--Create a TCP connection to the standard port on the HTTP connection--port 80 on local sock = assert (Socket.connect (host)) sock:s End ("GET": File: "http/1.0\r\n\r\n") repeat --takes 1K bytes to receive the data, and receives the byte block output to the local chunk, status, partial = Sock:receive (1024x768) Print (chunk or partial) until status ~= "closed"--close TCP connection sock:close ()
Widow System luaforwindows, installation Luasocket