Home > other >  The lua language to open the file is written to an error
The lua language to open the file is written to an error

Time:09-23

The local socket=the require "socket"

The host="192.168.43.193"

The function the download (host, file)
The local f=IO. Open (" test. JPG ", "w +")
The local c=assert (socket. Connect (host, 8080));
C: the send (" GET ".. The file.. "HTTP/1.0 \ r \ n \ r \ n")
While true do
The local s, status, partial=c: receive (1024);
F: write or partial (s)
If the status=="closed" then
Break
End

End
C: the close ()
F: close ()
End

The download (host, "/test. JPG")

Error message:



126 lua entry thread aborted: the runtime error:... Ervers/distribution_nginx/distribution_app//tests. The lua lua: 11: attempt to index the local 'f' (a nil value)
Stack traceback:
Coroutine 0:
. Ervers/distribution_nginx/distribution_app//tests. The lua lua: in function 'download'

CodePudding user response:

How could prompt line 11 f is empty

CodePudding user response:

F: the write line (s) or partial suggests this is wrong
  • Related