MTA:Eir/FileSystem/translator/delete: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ This function deletes an entry on the translator filesystem. If the path points at a directory, the whole content of it is recursively deleted. A typical reason when de...")
 
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool translator.delete ( string path )
bool translator:delete ( string path )
</syntaxhighlight>
</syntaxhighlight>


==Arguments==
==Arguments==
*''path:''' a path to a filesystem object that should be wiped out
*'''path:''' a path to a filesystem object that should be wiped out


==Returns==
==Returns==
Line 15: Line 15:
==Example==
==Example==
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
This snippet nukes the contents of your clientside resource. It can be used as protective measure when clientside files should not be leaked to curious users.
This snippet nukes the contents of your client-side resource. It can be used as protective measure when client-side files should not be leaked to curious users.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Nuke ourselves.
-- Nuke ourselves.
fileCreateTranslator( "/" ).delete( "/" );
fileCreateTranslator( "/" ):delete( "/" );
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
{{:MTA:Eir/FileSystem/translator/functions}}
{{:MTA:Eir/FileSystem/translator/functions}}

Latest revision as of 23:24, 16 January 2022

This function deletes an entry on the translator filesystem. If the path points at a directory, the whole content of it is recursively deleted. A typical reason when deletion may fail is when the file is opened in another OS handle. Proper clean-up of file classes can prevent this issue.

Syntax

bool translator:delete ( string path )

Arguments

  • path: a path to a filesystem object that should be wiped out

Returns

This function returns true if the specified filesystem object could be completely deleted, false otherwise.

Example

Click to collapse [-]
Client

This snippet nukes the contents of your client-side resource. It can be used as protective measure when client-side files should not be leaked to curious users.

-- Nuke ourselves.
fileCreateTranslator( "/" ):delete( "/" );

FileSystem Translator Functions