XmlDeleteData: Difference between revisions
(Added xmlDeleteData) |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 86: | Line 86: | ||
==See Also== | ==See Also== | ||
{{ | {{Template:Shared_xml_functions}} | ||
[[Category:Useful Functions]] | [[Category:Useful Functions]] |
Latest revision as of 16:36, 13 September 2019
Important Note:
This is an unofficial MTA function, so its not included into the game by default. |
This function provides a way of deleting a XML file created by xmlSaveData
To call it, see the call function or the tip in this resources page: Simplifying the export
Info
For proper deletion you need to pass the same booleans / securityLevel as you did on xmlSaveData.
If you called xmlSaveData with passing the securityLevel its recommended to pick securityLevel as function paremeter for the deletion as well.
Syntax
bool xmlDeleteData ( string fileName [, bool serverProtected = true, bool resourceProtected = false ] )
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )
Required Arguments
- fileName: The name of the file you want to delete.
Optional Arguments
- serverProtected: If set to true it can only delete the file of the creator-server, otherwise it doesn't care which server created it.
- resourceProtected: If set to true it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.
or
- securityLevel: The level of security on which your data is stored at. (Details on the resource page: Security Levels)
See xmlData Variables and Specified names for more detail.
Returns
Returns true if successful, false and a debug output in case if failure.
Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files.
bool xmlDeleteData ( string fileName [, bool resourceProtected = false ] )
bool xmlDeleteData ( string fileName [, int securityLevel = 4 ] )
Required Arguments
- fileName: The name of the file you want to delete.
Optional Arguments
- resourceProtected: If set to true it can only delete the file of the creator-resource, otherwise it doesn't care which resource created it.
or
- securityLevel: The level of security on which your data is stored at. (Details on the resource page: Security Levels)
See xmlData Variables and Specified names for more detail.
Returns
Returns true if successful, false and a debug output in case if failure.
Note: There is no encryption parameter in this function, because xmlDeleteData will auto-search for and delete the key of encrypted files. Note2: There is no serverProtected parameter, because its server-side already anyways.
Example
-- Lets assume we have created a resourceProtected-only file called "settings" already. local xml = exports.xmlData xml:xmlDeleteData("settings", false, true) -- not serverProtected, but resourceProtected -- OR xml:xmlDeleteData("settings", 1) -- securityLevel 1 equals not serverProtected, unencrypted, but resouceProtected - the encryption bool will be ignored at xmlDeleteData