Cryptography

base64_encode

Encodes a string into Base64.

Syntax

base64_encode(data: string): string
Aliases base64encodebase64.encodecrypt.base64.encodecrypt.base64_encodecrypt.base64encode

Arguments

NameTypeDescription
datastringThe string to be base64 encoded.

Returns

NameTypeDescription
encodedstringThe base64 encoded string.

Description

Encodes a string into Base64.

Call it with 1 parameter(s): data. The argument table explains which values are required and which ones only refine the behavior.

It returns encoded (string). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Encode text and decode it back to the original value.

local encoded = base64_encode("hello world")
local decoded = base64_decode(encoded)

print(encoded)
print(decoded)