Table.sort not working

table.sort not working for some reason and it returning nil

local userletters = string.split(user,"") -- user is a string1
			print(userletters,table.sort(userletters)) -- table.sort working here
			local ss = table.sort(userletters) -- for some reason table.sort not working and returning nil
			-- this code is an a while loop
			print(ss)
			for _,letter in ipairs(ss) do
				if table.find(goodletters,letter) then
					score += 2
				end
				if letter == ss[_+1] then
			
					score += 1
				end
			end

table.sort doesn’t return, it sorts the passed table.

local t = {5, 1, 4, 2, 3}
table.sort(t)
print(t) --> {1, 2, 3, 4, 5}
2 Likes

ohhh so it just sort it so no need to make it a variable thank you very much

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