{"id":13528763,"url":"https://github.com/DatZach/Destructors","last_synced_at":"2025-04-01T14:33:02.340Z","repository":{"id":69036991,"uuid":"258552685","full_name":"DatZach/Destructors","owner":"DatZach","description":"Destructors for GameMaker: Studio 2.3","archived":false,"fork":false,"pushed_at":"2022-10-24T18:33:09.000Z","size":35,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T02:50:49.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Yacc","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DatZach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-24T15:35:17.000Z","updated_at":"2024-12-31T16:53:41.000Z","dependencies_parsed_at":"2024-01-03T04:07:38.089Z","dependency_job_id":"4707f0b0-99d7-4ff2-861d-d0971e2ed8ba","html_url":"https://github.com/DatZach/Destructors","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DatZach%2FDestructors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DatZach%2FDestructors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DatZach%2FDestructors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DatZach%2FDestructors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DatZach","download_url":"https://codeload.github.com/DatZach/Destructors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246655249,"owners_count":20812607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:24.074Z","updated_at":"2025-04-01T14:33:00.637Z","avatar_url":"https://github.com/DatZach.png","language":"Yacc","readme":"# GML2.3 Destructors\n\nThis library adds destructors to GameMaker: Studio 2.3's release. This allows you to use `ds_*` types such as `list`s and `map`s inside of `struct`s without fear of leaking memory when they're deleted.\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.\n\n### Installation via Local Package (.yymps)\n\nGameMaker Studio 2 allows you to import assets, including scripts and shaders, directly into your project via the \"Local Package\" system. From the [Releases](https://github.com/DatZach/Destructors/releases) tab for this repo, download the .yymp file for the latest version. In the GMS2 IDE, load up your project and click on \"Tools\" on the main window toolbar. Select \"Import Local Package\" from the drop-down menu then import all scripts from the Destructors package.\n\n### Installation via Copy/Paste\n\nYou can simply copy and paste the contents of [Destructors.gml](https://github.com/DatZach/Destructors/blob/master/scripts/Destructors/Destructors.gml) into a new Script in your project.\n\n### Usage\n\nDestructors are registered via the `dtor_track(type, value, [option])` function. This function can be called multiple times on the same struct instance to registered multiple destructors.\n\nIn order to register a destructor callback,\n\n*Note that struct members cannot be accessed inside of the callback.*\n```javascript\nfunction foo() constructor {\n\tname = \"Zach\";\n\t\n\tdtor_track(DtorType.Function, function () {\n\t\tshow_debug_message(\"Destructed!\");\n\t});\n}\n\nvar a = new foo();\ndelete a;           // \"Destructed!\"\n```\n\nIn order to register a destructor to clean an allocated `ds_*`,\n```javascript\nfunction test1() constructor {\n    list = ds_list_create();\n\n    dtor_track(DtorType.List, list);\n}\n\nvar a = new test1();  // foo.list exists\ndelete a;             // foo.list has been destroyed\n```\n\nAdditionally, `Sprite`, `Surface`, `VertexBuffer`, `VertexFormat`, `Path`, `AnimCurve` and `Instance` types can be destroyed via `dtor_track`.\n\n## Running the Example\n\nClone this repo and open and run the project in GameMaker: Studio. Follow the on screen instructions for a demonstration of the library.\n\n## Authors\n\n* **Zach Reedy** - *Developed first implementation. Finalized codebase.* - [DatZach](https://github.com/DatZach)\n* **Juju Adams** - *Second draft implementation. Examples.* - [JujuAdams](https://github.com/JujuAdams)\n* **Torin Freimiller** - *Initial discoveries related to tracking objects.* - [Nommiin](https://github.com/nommiin)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","funding_links":[],"categories":["Data Manipulation"],"sub_categories":["Recommendations"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDatZach%2FDestructors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDatZach%2FDestructors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDatZach%2FDestructors/lists"}