{"id":18358339,"url":"https://github.com/kerwanp/core-types-generator","last_synced_at":"2025-04-06T13:31:31.563Z","repository":{"id":38832100,"uuid":"374134560","full_name":"kerwanp/core-types-generator","owner":"kerwanp","description":"Lua types generator for https://www.coregames.com/","archived":false,"fork":false,"pushed_at":"2022-09-21T23:32:40.000Z","size":2830,"stargazers_count":6,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T19:03:35.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kerwanp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-05T14:27:40.000Z","updated_at":"2023-03-15T20:27:55.000Z","dependencies_parsed_at":"2023-01-17T18:01:11.472Z","dependency_job_id":null,"html_url":"https://github.com/kerwanp/core-types-generator","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/kerwanp%2Fcore-types-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerwanp%2Fcore-types-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerwanp%2Fcore-types-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerwanp%2Fcore-types-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kerwanp","download_url":"https://codeload.github.com/kerwanp/core-types-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247488487,"owners_count":20946953,"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-11-05T22:17:35.077Z","updated_at":"2025-04-06T13:31:29.943Z","avatar_url":"https://github.com/kerwanp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Core Games API - Unofficial Lua Types\n\n## WIP Disclaimer\n\nThis project is still a work in progress and needs some improvements:\n\n- [x] Use the [CoreGameAPI.json](https://docs.coregames.com/assets/api/CoreLuaAPI.json) file\n- [x] Change output file `core-games-api.def.lua` (currently using the one on Github)\n- [x] Implements global `script` (not defined in CoreGameAPI)\n- [x] Generate file structure with full implementation\n  - [x] Namespaces\n  - [x] Classes\n  - [x] Enums\n  - [x] Inheritance\n- [ ] Better Event Type with use of Generics\n- [x] Optional function parameters\n- [ ] Create daily release system\n- [ ] Provide a better documentation\n- [x] Improve code structure\n\n## Why?\n\nType checking provide a good flexible autocomplete system and give you errors when you are trying to access undefined properties.\n\n### Without Types\n\n![withoutTypes](assets/gif1.gif)\n\n### With Types\n\n![withTypes](assets/gif2.gif)\n\n## Install\n\nAs the types are just from a simple Lua file it can be understand in any IDE, VSCode, Jetbrains, etc.\nI still encourage to use IntelliJ IDEA, it provides stronger understanding of types.\n\n### VSCode\n\n#### 1. Install vscode-core\n\nGet the official [vscode-core](https://marketplace.visualstudio.com/items?itemName=ManticoreGames.vscode-core) extension which is based on the config file generated here.\n\n### IntelliJ IDEA (or PhpStorm, Webstorm, etc)\n\n#### 1. Install EmmyLua\n\nIn order to enjoy the power of [LDoc](https://stevedonovan.github.io/ldoc/manual/doc.md.html) you must use a plugin that understand it.\n\nFor that, install the [Luanalysis plugin for JetBrains](https://plugins.jetbrains.com/plugin/14698-luanalysis)\n\n#### 2. Open your project with JetBrains\n\nFirst, you must retrieve the location of your project.\nFor that Right Click on a script in the Core Editor Project Content, click on `Show in explorer` and copy the link of the directory.\n\nThen open Jetbrains and click on `File \u003e Open...` and paste the path of your scripts folder.\n\n#### 3. Add the definition file to your project\n\nIn the Core editor, create a new Script called `CoreGamesAPI` and delete it from the hierarchy.\nOpen the script in your IDE and paste the content of [core-games-api.def.lua](dist/core-games-api.def.lua) in it.\n\nDone! You can now code and have full autocomplete for the Core Games API and also for your own scripts!\n\n## How\n\nWhenever you code, typing what you write is always a good thing. For you, and for the others.\n\n### Functions\n\nBy typing your function parameters, you will be able to have full autocompletion inside your functions.\nAnd by typing the return, you will be able to call this function anywhere in your application and still enjoying the autocomplete and the type checking.\n\n```lua\n--- @param player Player\n--- @return number\nfunction GetMoney(player)\n    return player:GetResource(\"money\")\nend\n```\n\n### Locals\n\nBy typing your locals you will be able to enjoy autocomplete and type checking even on your custom properties !\n\n```lua\n--- @type number\nlocal customProperty = script.parent:GetCustomProperty(\"customProperty\")\n\n--- @type ScriptAsset\nlocal myScript = script.parent:GetCustomProperty(\"myScript\")\n```\n\n### Classes\n\nYou create your own types by adding LDoc to your classes.\n\n```lua\n--- @class MyClass\nMyClass = {}\n\nreturn MyClass\n```\n\nNow you can use this type to enjoy autocompletion on your own modules.\n\n```lua\nlocal propMyScript = script.parent:GetCustomProperty(\"myScript\")\n\n--- @type MyClass\nlocal MyClass = require(propMyScript)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerwanp%2Fcore-types-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkerwanp%2Fcore-types-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerwanp%2Fcore-types-generator/lists"}