Sets the environment of the given object to the given table. Returns object.