Case insensitivity is not what Lua handles. All table scans and local access variables are eventually compared with a case-sensitive string.
The best solution would be to simply recognize that you are dealing with a case-sensitive system, like C ++, and dealing with it.
However, if you really want it, you can do it. The easiest way is to put all possible name permutations in your function table. So your function table will have the following:
["setname"] = theFunction, ["Setname"] = theFunction, ["sEtname"] = theFunction, ["SEtname"] = theFunction, ...
You can, of course, automate this with a function that takes every name in the table and replicates its data based on case permutations.
A more complex, but easier to use mechanism will be the use of the __index and __newindex , as well as the empty table trick.
function CreateCaseInsensitiveTable() local metatbl = {} function metatbl.__index(table, key) if(type(key) == "string") then key = key:lower() end return rawget(table, key) end function metatbl.__newindex(table, key, value) if(type(key) == "string") then key = key:lower() end rawset(table, key, value) end local ret = {} setmetatable(ret, metatbl) return ret end
Instead of creating a table with {}, you create a table with this function call. Otherwise, the table should work fine (although obviously access to the member will be slightly slower).