Solution for Why does this remove all “%” lua
is Given Below:
So I am working on this obfuscator and when I add my encoding algorithm after the first “)” it removes all “%” in the algorithm, how do I fix this?
Here is the way i do it:
newScript = newScript:gsub('%)', algorithm , 1)
I suggest reading the PIL regarding captures. The symbol %
is a special character, therefore you need to escape it:
newScript = newScript:gsub('%)', algorithm:gsub('%%', '%%%%'), 1)
This replaces every %
in your replacement string with %%
, which will then become %
when used as replacement in newScript
.
The PIL even clearly says:
By the way, because of those changes, a `%´ in the replacement string
must be escaped as “%%”.