I see it everywhere and know some examples of it being used, but I don't have a complete understanding of it. I've tried looking online for a bit but found nothing.
local strings = {"Hello", "World!"}
local ARandomStringThing = strings[math.Random(1, #Strings)] -- Uses #String
print(ARandomStringThing) -- Would print Hello or World
--Random String Picker
This piece of code above uses #string on line 2.
function findPlayer(r)
for i, v in pairs(game.Players:GetPlayers()) do
local n = v.Name:lower()
if r == n:sub(1, #r) then -- #string
return v
end
end
end
This other example above is a part in my admin script, which is a function which finds a player even if you don't type the full name and uses #string. So again, what does #string mean?
