#can anyone tell me the name of this thing?

20 messages · Page 1 of 1 (latest)

vapid jolt
#

Try looking for things like string.findz which can help find another string like what you wanted inside of the main word

spring kettle
#

string.find

#

there are two required parameters

ruby bluff
#

oh ok

spring kettle
#

and two optional ones

#

the long and short of it is that

ruby bluff
spring kettle
#

string.find(str,comp) takes in a string, which is str, in this case, and looks for any instance of another string, comp, in this case, within str

#

if it isn't found it returns nil, or nothing, and if it is found, it returns the index of where comp first appears in str

#

so something like

#
local index = string.find("ABCDEFG","F")
print(tostring(index))
#

would print 6, since that's where the first occurrence of F is in the string

ruby bluff
#

ok

spring kettle
#
local index = string.find("ABCABCABC","B")
print(tostring(index))
#

it only finds the first occurrence though

#

so something like this would print 2, since the first place it found the letter B in str is at index 2.

#

you could use this to delete every object that has a certain string in its name

#
for _,v in pairs(workspace:GetDescendants())
  if string.find(v.Name,"Vest") then
    v:Destroy()
  end
end
ruby bluff
#

okie dokie