The above code (after adding some missing = in the table assignment at the botom) has been uploaded as version 0.2.
I also started work on a function that gives you a value indexed array of the keys. This is my code so far (not done any testruns):
Lua Code:
function lib:getValIndexedKeyList(input)
--assert that input is remotely valid
assert (input ~= nil and type(input) == "table", "input must be not nil and a table")
local result = {}
for outerkey, outervalue in input do
--assert that this index of input has the right contained elements
assert (type(outervalue) == "table" and outervalue.key ~= nil and outervalue.value ~= nil, "Key: '" .. outerkey .. "' is not a table or does not contain a pair of key/value indexes")
--Some local variables to shorten the syntax
local innerkey, innervalue = outervalue.key, outervalue.value
--Check if this value has already been used as key
assert(result[innervalue] == nil, "Key: '" .. outerkey .. "' contains the duplicate value '" .. innervalue .. "'")
result[innervalue] = innerkey
end
return result
end