Alright so I made a program that processes data, but I need to run this function on the string, and sometimes the data is 29,000,000+ characters long. If I run a loop like
for x = 1, 29000000, 1 do
end
print("Done")
It finishes instantly, now I'm not asking for someone to try and make this finish instantly, but how can I make it finish faster because it currently takes 3+ hours to get to 10 percent done, so basically is there a way to maybe allow lua to use more cpu or maybe make my function more efficient
local function interpret(action, input, key)
local byte, char, decrypt, encrypt, input, output, sub = string.byte, string.char, key.decrypt, key.encrypt, input, '', string.sub
if (action == "decrypt") then
for x = 1, (#input), 1 do
output = (output .. (char(((byte(decrypt[sub(input, x, x)]) - (x + 2)) + 1) % 256)))
if x % 10000 == 0 then print(x) end
end
else
for x = 1, (#input), 1 do
output = output .. (encrypt[char(((byte(sub(input, x, x)) + x) + 1) % 256)])
if x % 10000 == 0 then print(x) end
end
end
return (output);
end