local socket=require "socket"
host = "192.168.43.193"
function download(host,file)
local f = io.open("test.jpg","w+")
local c = assert(socket.connect(host,8080));
c:send("GET "..file.." HTTP/1.0\r\n\r\n")
while true do
local s,status,partial = c:receive(1024);
f:write(s or partial)
if status == "closed" then
break
end
end
c:close()
f:close()
end
download(host,"/test.jpg")
錯誤資訊:
126 lua entry thread aborted: runtime error: ...ervers/distribution_nginx/distribution_app/lua/tests.lua:11: attempt to index local 'f' (a nil value)
stack traceback:
coroutine 0:
...ervers/distribution_nginx/distribution_app/lua/tests.lua: in function 'download'
uj5u.com熱心網友回復:
提示 11行 f 怎么可能 為空呢uj5u.com熱心網友回復:
f:write(s or partial) 提示這行 有錯轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/68469.html
標籤:其他開發語言
上一篇:PyCharm啟動報錯!
下一篇:大神看看啥問題??
