myMetaTable = {
__index = function(table, index)
print("Sorry, but the element ".. tostring(index).. " does not exist.")
-- runs when you try to index a nil element of the table this metatable is connected to, table[index]
end,
__newindex = function(table, index, value)
print("Sorry, but the element ".. tostring(index).. " can't be set to ".. tostring(value).. " because this element does not exist.")
-- runs when you try to index and set a nil element of the table this metatable is connected to, table[index] = value
end
}