"you could very easily transform it into a nicer code." this exactly the same answer the guy who created the CPP said... than... you look to...
lol.
since its obvious that you're just a beginner in lua, the easiest explanation for that code is: these three loops insert characters/numbers by their codes. That is the function
string.char, you can find information about this function here:
https://www.lua.org/pil/20.html You can also find this code in qb-core and many other scripts, since that's what stackoverflow provided these developers with, in this case i'll drop a qb-core repository link for ya
https://github.com/qbcore-framework/qb-core/blob/25e561f52bd4140528ac5610550c238986a30d1e/shared/main.lua#L6-L8
speaking of everything else you wrote here, 70% is just total nonsense out of not having any knowledge neither in lua or in encrypters/decrypters or obfuscators/deobfuscators. And just so you know, an obfuscator is different from an encrypter, e.g. you cannot decrypt an obfuscated code, or deobfuscate an encrypted code, so please don't mix these two up, you can find more information about it on google.
considering all this bullshit you wrote, there's no reason for me to continue the discussion until you come back with strong knowledge of the lua language, and not the knowledge on searching for answers in stackoverflow.