Register a new metatable as a Torch type with the given string name. The new metatable is returned.

If the string parentName is not nil and is a valid Torch type (previously created by torch.newmetatable()) then set the corresponding metatable as a metatable to the returned new metatable.

If the given constructor function is not nil, then assign to the variable name the given constructor. The given name might be of the form package.className, in which case the className will be local to the specified package. In that case, package must be a valid and already loaded package.