DecodeString: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 7: Line 7:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string decodeString ( string algorithm, string input, table options )   
string decodeString ( string algorithm, string input, table options [, function callback ] )   
</syntaxhighlight>  
</syntaxhighlight>  


Line 19: Line 19:
** ''key'': A key to decode the input with.
** ''key'': A key to decode the input with.


===Optional Arguments===
{{New feature/item|3.0160|1.5.7|20394|
*'''callback:''' providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.
}}
===Returns===
===Returns===
Returns the decoded string if successful, ''false'' otherwise.
Returns the decoded string if successful, ''false'' otherwise. If a callback was provided, the decoded string is argument to the callback.


==Example==
==Example==

Revision as of 09:28, 25 January 2020

This function decodes an encoded string using the specified algorithm. The counterpart of this function is encodeString.

Syntax

string decodeString ( string algorithm, string input, table options [, function callback ] )  

Required Arguments

  • algorithm: The algorithm to use.
  • input: The input to decode.
  • options: A table with options and other neccessary data for the algorithm, as detailed below.

Options for each algorithm

Optional Arguments

  • callback: providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.

Returns

Returns the decoded string if successful, false otherwise. If a callback was provided, the decoded string is argument to the callback.

Example

Accessories-text-editor.png Script Example Missing Function DecodeString needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.
-- TODO


See Also