Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base64 & hex decoding to @lune/serde #292

Open
Hexcede opened this issue Jan 6, 2025 · 3 comments
Open

Add base64 & hex decoding to @lune/serde #292

Hexcede opened this issue Jan 6, 2025 · 3 comments

Comments

@Hexcede
Copy link

Hexcede commented Jan 6, 2025

Lune does not currently provide a way to do base64 or hexadecimal encoding/decoding. Both of these would be extremely useful when interacting with various APIs over HTTP.

@CompeyDev
Copy link
Contributor

Hex encoding and decoding can already be done in Luau, unless I am misunderstanding you.

-- Encode
local encoded = string.format("%x", int)

-- Decode
local decoded = tonumber(encoded, 16)

@Hexcede
Copy link
Author

Hexcede commented Jan 8, 2025

Hex encoding and decoding can already be done in Luau, unless I am misunderstanding you.

-- Encode
local encoded = string.format("%x", int)

-- Decode
local decoded = tonumber(encoded, 16)

You can implement hex encoding/decoding in pure lua/luau, but, you can also do the same for JSON, TOML, Base64, etc, to varying ease of implementations. Having these as part of serde is a lot more of a QoL and performance interest than a necessity.

@CompeyDev
Copy link
Contributor

You should specify that you want support for hex and base64 encoding for serializing data. The current issue is a bit vague and comes off as general support for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants