Home  Contents

string.to64

String Core4 Lua Commands

SYNOPSIS

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

DESCRIPTION

Converts s into base64 encoding.

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, ASCII text.

ERRORS

Passed data must be a string or a number, or else an error is thrown.

NOTES

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

EXAMPLE

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

SEE ALSO