Make All Strings in a Table Lowercase

I want to turn this:

{"Derpy", "DerpyHooves", "Muffins", "DitzyDoo"}

Into this:

{"derpy", "derpyhooves", "muffins", "ditzydoo"}
1 Like
for i,v in table do
v = string.lower(v)
end

EDIT: (include the table’s variable name inside of a for loop, instead of just “table”)

That didn’t work:(

When I print the table, it is the same as before:

local allPonyNames = {"Derpy", "DerpyHooves", "Muffins", "DitzyDoo"}

for _, v in pairs(allPonyNames) do
	v = string.lower(v)
end

print(allPonyNames)

this should do the trick then.

local allPonyNames = {"Derpy", "DerpyHooves", "Muffins", "DitzyDoo"}

for i,v in pairs(allPonyNames) do
	allPonyNames[i] = string.lower(v)
end

print(allPonyNames)
2 Likes

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