string.similarity(str1, str2)function
Calculate the similarity between two strings, using Levenshtein distance algorithm.
Parameters
str1
The first string to be evaluated for similiarity.
str2
The second string to be evaluated for similiarity with the previous one.
Return value
Returns a number between 0 (no similarity at all) and 100 (strings are the same)Example
local word = "bird"
-- outputs 60
print("Similarity between 'bird' and 'bread' : "..word:similarity('bread'))