So lets say I have a dictionary,
local dict = {
["hello"] = 123,
["world"] = 456
}
and now I want to use table.remove() to remove hello from the dictionary. Problem is table.remove() only takes a number for the second parameter (index of which to remove).
How would I go about doing this?
Here's a function I've made, but it's complete crap.
function GetIndexFromDictionary(tbl, str)
local n = 0
for i,v in next, tbl do
print(i)
n = n + 1
return i == str and n
end
end

1 comment
In addition to SatireIncarnate's answer, I'd like to point out that table.remove only works on arrays, since the second argument it requires is the numeric key it's searching the table for.