Posted 09 July 2014 - 08:22 PM
For some reason, sString:find( word ) is returning a single value instead of two… as it is supposed to according to http://lua-users.org/wiki/StringLibraryTutorial. Is it simply returning the start of the word (from which I can find the rest of it), or is it doing something else?
function zip( sString )
local len = #sString
for i = 16, 6, -1 do
for x = 1, i do
for word in sString:sub( x ):gmatch( string.rep( ".", i ) ) do
local s, e = sString:find( word )
local replace = "<"..s..","..e..">"
sString = sString:gsub( word, replace )
sString = sString:sub( 1, x )..word..sString:sub( x + #replace )
sString = sString:gsub( word:reverse(), "<"..e..","..s..">" )
sleep( 0 )
end
end
end
return sString, len - #sString
end