Itt egy recursive megoldás, loop nélkül. @rusztamas, rövidítsd le
local something = \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"
function addCharToString(str, pos, chr, howMany, origPos)
if howMany == 0 then return str end
if not origPos then origPos = pos end
local stringVariation = str:sub(1, pos - 1) .. chr .. str:sub(pos + 1)
howMany = howMany - 1
return addCharToString(stringVariation, pos + origPos, chr, howMany, origPos)
end
print(addCharToString(something, 5, \"%\", 17))