Home  Contents

string.from64

String Core4 Lua Commands

SYNOPSIS

result = string.from64(s [, i [, j]])

DESCRIPTION

Decodes base64 encoded ASCII data into binary.

When i and/or j are given, uses the substring s[i], s[i+1], ···, s[j].
The default value for i is 1; the default value for j is the number of characters in s.

RETURN VALUE

String containing the decoded data.

ERRORS

Passed data must be a string, or else an error is thrown.
If data does not contain valid base64 encoded data, this function returns nil.

NOTES

Base64 is commonly used to encode email attachments. It contains only valid 7-bit ASCII characters.

EXAMPLE

print(string.from64("QUJDRDQq"))
ABCD4*

SEE ALSO