Difference between revisions of "Lua:deleteFile"
Jump to navigation
Jump to search
(Initial page creation.) |
m (Syntax Highlighting.) |
||
| Line 21: | Line 21: | ||
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
local path = "C:\\\\Temp\\\\example.txt" | local path = "C:\\\\Temp\\\\example.txt" | ||
| Line 29: | Line 29: | ||
print("File was not deleted") | print("File was not deleted") | ||
end | end | ||
| − | </ | + | </syntaxhighlight> |
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
Latest revision as of 19:55, 25 June 2026
<> Reference
function deleteFile(pathtofile) : boolean
Deletes the file at the specified path.
Returns true if a file existed at that path and does not exist anymore after the call.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| pathtofile | String | The path to the file to delete. |
Returns[edit]
boolean — True if a file existed at the specified path and no longer exists after the call, otherwise false.
Examples[edit]
1 local path = "C:\\\\Temp\\\\example.txt"
2
3 if deleteFile(path) then
4 print("File deleted")
5 else
6 print("File was not deleted")
7 end
See Also[edit]
Main Pages