Is there a way to move every byte of data in a 200K file to a new location, like a Big Endian file to a Small Endian, and write it back out quickly?
I am using string functions now, should I be using tables? How would I?
My method is taking over several seconds, but it must be preceived as instant. Any ideas?
io.file( file, “r” ); local str1 = “”; str1 = file:read(*a); io.close( file )
local str2 = “”; local str1Len = string.len(str1)
– now the slow part –
for i=0, str1Len-1, 2 do
str2 = str2 … str1:sub(str1Len-i-1, str1-i)
end
file2 = io.open( file2, “w” );
file2:write( str2 );
io.close( file2 ) [import]uid: 47723 topic_id: 9254 reply_id: 309254[/import]