Hi, I'm trying to make an encrypted message in a particular way.
For instance if i wanted to encrypt "This is a string" I have this;
print(table["concat"]({"", 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6E, 0x67}, "\\"))
Each item in that table is a letter in "This is a string" but in hexadecimal.
However when I run that piece of code what I get is;
\84\104\105\115\32\105\115\32\97\32\115\116\114\105\110\103
However I was looking for
This is a string
Essentially I'm trying to make a one liner and as compact as possible with no upvalues.
ie; print"hi";
loadstring(table["concat"]({"", 0x70, 0x72, 0x69, 0x6E, 0x74, 0x22, 0x68, 0x69, 0x22}, "\\"))()
turns into;
loadstring(table["concat"]({"", 0x70, 0x72, 0x69, 0x6E, 0x74, 0x22, 0x68, 0x69, 0x22}, "\"))():1: attempt to call a nil value
I can deal with at most 1 or 2 upvalues but I need a way to tell the game to take the string as escaped characters. I'm also not interested in just;
loadstring("\84\104\105\115\32\105\115\32\97\32\115\116\114\105\110\103")()
I've tried tostring() and tonumber(), However both failed.
Here's my tohex formula;
local src = "r"
print("0x" .. string.format("X", string.byte(src))) -- Still prints 0x72 and not 114, WHY?
Ill keep searching online but this is pretty much where it comes down. Must be concat of hexadecimals and turn out to show the masked text via print or loadstring.

2 comments
out of curiosity, why do you do table["concat"] rather than with dot syntax? no criticism, ive just never seen anyone do that
It's for that reason. I kind of like using things no one else would try. But now I have a new formatting.