If I had understood correctly the question, the problem you have is that Lua allow nesting metatables when the __index metamethods are tables. In your case, because the first metatable has a __index function, you cannot chain a second one by returning "nil" in your function. I think you need something like this to make work your approach (written in Lua instead of C, but you can translate it):
-- a table with functions (which would be your list
-- of functions at your second __index metamethod)
local index_table = { foo = function(self,...) do something end }
-- the metatable for your objects
local mt = {
__index = function(t, k)
if type(k) == "number" then return some value end
return rawget(t,k) or index_table[k]
end
}
local new_obj = setmetatable({}, mt)