URLEncode & URLDecode

The FireflyAIO Lua API provides functions URLEncode and URLDecode to handle the encoding and decoding of URLs, similar to the functions available in C#.

URLEncode

The URLEncode function is used to convert a string into a valid URL format by escaping special characters. This ensures that the string can be safely included in a URL.

Here is an example of how to use the URLEncode function:

-- Encode a string to be safely included in a URL
local encodedURL = URLEncode("Hello World!")

In this example, the function call URLEncode("Hello World!") will convert the string "Hello World!" into a URL-safe format, resulting in something like "Hello%20World%21".

URLDecode

The URLDecode function is used to convert a URL-encoded string back to its original format. This is useful for decoding query parameters or any other URL-encoded data.

Here is an example of how to use the URLDecode function:

-- Decode a URL-encoded string
local decodedURL = URLDecode("Hello%20World%21")

In this example, the function call URLDecode("Hello%20World%21") will convert the URL-encoded string back to its original form, resulting in "Hello World!".

These functions are essential for handling URL encoding and decoding, ensuring that your URLs are correctly formatted and can be safely used in HTTP requests within your custom checkers in FireflyAIO.

Last updated