is it possible is it possible it reverse the keys and values so in a list that looks like this
{
[1]="a",
[2]="b",
[2]="c"
}
turn it in to this
{
[a]="1",
[b]="2",
[c]="3"
}
i need it to see how far through a list a letter is
(sorry if i typed this bad)
I guess, but you have to have the compromise that no two objects can have the same value in the initial array, else it will lose data.
(e.g. you cant have
{
a = 3,
b = 3
}
)
function SwitchKeyVals(input)
local out = {}
for a, b in input do
out[b] = a
end
return out
end
1 Like
system
(system)
Closed
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.