Hi there.
I'm coding here [as are we all] and I have a string.
local myString = "pla"
Now then, I want to take my string and find the nearest equivalent in this table
local myTable = {"player","playing","played","notplayed"}
I only want to list all closest options. So that'd mean it would run this:
for i,v in pairs(nearestEquivalent) do
print(v) -- or in my case addToList(v)
end
and getting this:
> player
> played
> playing
Now then, how would I go about doing this.
I thought string.sub would work but that finds all the letters not just a selection.
I COULD make the string.sub run every time a letter was added or removed but that'd be unnecesarry code if theres another way
Bear in mind I'm trying to keep all this as clean as possible, with the BEST performance possible.
Thanks!
-Reece

1 comment
use string.match