Lua를 사용하여 파일 크기를 가져 오는 데 문제가 있습니다. 파일의 파일 크기가 743 bytes
이면 파일이 삭제되는 함수 메소드를 작성 중입니다.루아에서 파일 크기와 파일을 삭제하는 방법은 무엇입니까?
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
누구도 날이 내 사건에 대해 도움을 줄 수 있습니다 : 여기
내 코드?
감사 LHF을 삭제하려면 여기 http://keplerproject.github.com/luafilesystem/manual.html#reference
를 읽을 수 있습니다
을 사용하여 파일 크기를 얻을 수있다, 난 (인쇄'myfile에 시도 : seek ("end"))'하지만 내 코로나에서 이런 오류가 발생했다. 런타임 오류 ... ne \ 내 문서 \ 노래 우상 최종 게임 \ freeplay.lua : 258 : 시도 시도 닫힌 파일 사용 스택 추적 : [C] :? [C] : 함수 'seek' ... ne \ 내 문서 \ 노래 우상 최종 게임 \ freeplay.lua : 258 : 기능에서 'getDLFile' ... ne \ my d' – gadss
@ 가제트, 그것 그 파일을 닫을 때 찾기 전에 파일을 닫은 것 같습니다. – lhf
여기를 참조하십시오. http://www.lua.org/pil/21.3.html – frgtv10