Apologies for the confusing wording, I wasn’t too sure what this type of function is usually referred to as
I’ve been trying to create my very own admin system to learn things like string patterns, and I’m stumped on one thing.
Let’s say the player types “inv” or “invs.” I want a script to find if the text they type has letters that are part of a certain word to make the proper command function without having the player type the whole word.
I’ve been trying to figure out what type of string manipulation I should use. So far, I’ve tried string.match and string.find, however, neither have worked.
Here’s some placebo code to put it into Lua language:
local Word = "invisible"
local TextPlayerTyped = "invs" -- Of course, this would be a text box input, however for demonstration purposes I'm just making this a string variable
if string.something(Word, TextPlayerTyped) then
print("Invisible!")
end
local Word = "invisible"
local TextPlayerTyped = "invis"
if string.match(Word, TextPlayerTyped) then
print("Invisible!")
end
if string.find(Word, TextPlayerTyped) then
print("Invisible!")
end
I got both of these to print, do you want something else?