String lib warning

Hello,

I would like to know why I am getting a warn about these lines:

			local labelName = string.sub( -- Permet de reconstituer le nom du joueur qui est dans le textlabel
				"1."..tostring(i).." "..v.Name, -- Prend le nom du textlabel
				string.find("1."..tostring(i).." "..v.Name, v.Name) -- Prend les index du nom du textlabel
			)

Can you please specify exactly where the warning is? Also I don’t know what i and v are but I know they come from the for loop.

i is a for loop and v is a player objet which come from a for _,v loop.

The ewarning come from the last line: string.find("1."..tostring(i).." "..v.Name, v.Name)

does the for loop look like this for _,v or for i,v if it’s the first one then the error would most likely come from i being nil since you assigned it to be _

I changed it but it’s was for this code.

It was this and i > 0 so I do not think it can come from it.

after looking at your code for a second i realized that you’re not using string.sub correctly, you only have 2 arguments, the second argument is a table and should be a number and the third one is just nil

1 Like

Alright, thank you for this information :).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.