我有使用Lua获取文件大小的问题.我正在创建一个函数方法,如果文件的文件大小是743字节,那么该文件将被删除.
这是我的代码:
- local getDLFile = function(fileToDL)
- local path = system.pathForFile(fileToDL,system.DocumentsDirectory )
- local myFile = io.open( path,"w+b" )
- http.request{
- url = "http://www.testfile.com/"..fileToDL,sink = ltn12.sink.file(myFile),}
- -- i don't know what is the Syntax
- if myFile.size == 743 bytes then
- myFile.delete
- end
- end
任何人都可以帮助我关于我的情况吗?