In case you don't understand how it works heres explanation
That function (in the url above) does the following:
converts each letter and letter of the search string to base 16 value ( builds up an array of byte) and of the replace string to base 10 value, it inserts all bytes into array(table).
it connects all search table with a space between entry and entry (does not touch the replace table) and thus creates an array of byte.
It scans for the aob, and for each each result found it writes the replace table.
How to call it?
replaceString(string_in,string_out,ignore_length);
string_in - the string you want to find (input type string)
string_out - the string you want to replace with (input type string)
ignore_length - ignore length of the 2 strings given (like if you try write 4 character word into 3 character word, that can really mess up your game, since it it will override other stuff that comes after that string..) (input type boolean).
Example
replaceString("Hi","He")
Function will return true if found, we didn't have to insert the true as third parameter as the length between the 2 strings is equal.
But if we do this
replaceString("Hi","Bye")
The function will print "Not recommended to override shorter string with a longer string", since again it can override stuff that it shouldn't.
To ignore that, just call it in this way
replaceString("Hi","Bye",true)
This will ignore the length check and override the string.
Btw:
Replace replaceString with FindAndReplaceString if function name matters that much for you.. lol. _________________
I'm rusty and getting older, help me re-learn lua.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum