From 86506f74e3bef272d33b6d4c0dee494261689ec4 Mon Sep 17 00:00:00 2001 From: Sheridan C Rawlins <41922797+scr-oath@users.noreply.github.com> Date: Thu, 26 Jun 2025 12:45:29 -0700 Subject: [PATCH 1/3] Update README.md Add hex to the top-level README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cad4e5a..d1d227a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ go get github.com/vadv/gopher-lua-libs * [db](/db) access to databases * [filepath](/filepath) path.filepath port * [goos](/goos) os port +* [hex](/hex) Port of [encoding/hex](https://pkg.go.dev/encoding/hex) * [http](/http) http.client && http.server * [humanize](/humanize) humanize [github.com/dustin/go-humanize](https://github.com/dustin/go-humanize) port * [inspect](/inspect) pretty print [github.com/kikito/inspect.lua](https://github.com/kikito/inspect.lua) From d2ed14eeea82bee4c3279760c0c1f42ad439f9e9 Mon Sep 17 00:00:00 2001 From: Sheridan C Rawlins Date: Thu, 26 Jun 2025 12:48:10 -0700 Subject: [PATCH 2/3] Fix the README for hex too. --- hex/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hex/README.md b/hex/README.md index cdfa2d5..f14fabc 100644 --- a/hex/README.md +++ b/hex/README.md @@ -9,19 +9,19 @@ Lua module for [encoding/hex](https://pkg.go.dev/encoding/hex) ```lua local hex = require("hex") -s = hex.RawStdEncoding:encode_to_string("foo\01bar") +s = hex:encode_to_string("foo\01bar") print(s) Zm9vAWJhcg -s = hex.StdEncoding:encode_to_string("foo\01bar") +s = hex:encode_to_string("foo\01bar") print(s) Zm9vAWJhcg== -s = hex.RawURLEncoding:encode_to_string("this is a and should be encoded") +s = hex:encode_to_string("this is a and should be encoded") print(s) dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA -s = hex.URLEncoding:encode_to_string("this is a and should be encoded") +s = hex:encode_to_string("this is a and should be encoded") print(s) dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA== From a3b01646d776e014a33fe3fcec2fb3a2faa74ef5 Mon Sep 17 00:00:00 2001 From: Sheridan C Rawlins Date: Thu, 26 Jun 2025 12:52:44 -0700 Subject: [PATCH 3/3] Fix the example in readme. --- hex/README.md | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/hex/README.md b/hex/README.md index f14fabc..a512dc8 100644 --- a/hex/README.md +++ b/hex/README.md @@ -11,19 +11,7 @@ local hex = require("hex") s = hex:encode_to_string("foo\01bar") print(s) -Zm9vAWJhcg - -s = hex:encode_to_string("foo\01bar") -print(s) -Zm9vAWJhcg== - -s = hex:encode_to_string("this is a and should be encoded") -print(s) -dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA - -s = hex:encode_to_string("this is a and should be encoded") -print(s) -dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA== +666f6f01626172 ``` @@ -32,12 +20,12 @@ dGhpcyBpcyBhIDx0YWc-IGFuZCBzaG91bGQgYmUgZW5jb2RlZA== ```lua local hex = require 'hex' -decoded, err = hex.decode_string("666f6f62617262617a") +decoded, err = hex.decode_string("666f6f01626172") assert(not err, err) print(decoded) foobar encoded = hex.encode_to_string(decoded) print(encoded) -666f6f62617262617a +666f6f01626172 ```