{"id":26869895,"url":"https://github.com/stevenlafl/tts-typescript","last_synced_at":"2025-05-07T04:23:08.155Z","repository":{"id":153282750,"uuid":"628455662","full_name":"stevenlafl/tts-typescript","owner":"stevenlafl","description":"Typescript Declarations for Tabletop Simulator","archived":false,"fork":false,"pushed_at":"2024-02-16T16:04:24.000Z","size":103,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T06:19:09.019Z","etag":null,"topics":["lua","node-js","tabletop-simulator","typescript","typescript-definitions","typescript-to-lua"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/stevenlafl.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,"dei":null}},"created_at":"2023-04-16T02:00:33.000Z","updated_at":"2025-01-17T16:01:21.000Z","dependencies_parsed_at":"2024-02-16T15:52:24.423Z","dependency_job_id":null,"html_url":"https://github.com/stevenlafl/tts-typescript","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenlafl%2Ftts-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenlafl%2Ftts-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenlafl%2Ftts-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenlafl%2Ftts-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevenlafl","download_url":"https://codeload.github.com/stevenlafl/tts-typescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252811189,"owners_count":21807905,"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":["lua","node-js","tabletop-simulator","typescript","typescript-definitions","typescript-to-lua"],"created_at":"2025-03-31T06:19:14.279Z","updated_at":"2025-05-07T04:23:08.118Z","avatar_url":"https://github.com/stevenlafl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Typescript Declarations for Tabletop Simulator\n\n\u003c/div\u003e\n\nHello! These types are intended to be used with [Typescript to Lua](https://typescripttolua.github.io). With that compiler you can transpile `.ts` files into `.lua` files. This package is the safety net for the Tabletop Simulator functions and objects. Let your editor have some nice autocompletion!.\n\n### Usage\n\n1. Install these packages and make a `src` directory: \n```\nnpm i tts-types typescript typescript-to-lua\nmkdir src\n```\n2. Create tsconfig.json:\n\n```json\n{\n  \"compilerOptions\": {\n    \"rootDir\": \".\",\n    \"outDir\": \"build\",\n\n    \"target\": \"ESNext\",\n    \"lib\": [\"ESNext\"],\n    \n    \"moduleResolution\": \"nodenext\",\n    \"module\": \"NodeNext\",\n\n    \"declaration\": false,\n    \"declarationMap\": false,\n\n    \"strict\": true,\n    \"types\": [\"tts-types\"],\n  },\n  \"tstl\": {\n    \"luaTarget\": \"5.2\",\n    \"noImplicitSelf\": true,\n    \"tstlVerbose\": true,\n    \"luaBundle\": \"bundle.lua\",\n    \"luaBundleEntry\": \"src/index.ts\",\n  },\n}\n```\n\nnote: we use `\"luaTarget\": \"5.2\"` to be compatible with the LUA version Tabletop Simulator uses.\n\n3. Create `src/index.ts`\n```typescript\n// The OnLoad function. This is called after everything in the game save finishes loading.\n// Most of your script code goes here.\nfunction onLoad( saveData: any ) {\n\n  // Lock color-UI cube\n  let cube = getObjectFromGUID( \"c1a0d1\" )\n  cube.interactable = false\n  cube.setLock( true )\n}\n```\n\n4. Your project is ready! run `npx tstl` to compile it into Lua\n```\nnpx tstl\n```\n\nYou will have some output like this:\n\n```\nLoaded 0 plugins\nParsing project settings\nTransforming C:/Source/tts-test/src/index.ts\nPrinting C:/Source/tts-test/src/index.ts\nConstructing emit plan\nResolving dependencies for C:/Source/tts-test/src/index.ts\nEmitting output\nEmitting C:/Source/tts-test/build/bundle.lua\nEmit finished!\n```\n\nYour .lua file now exists at build/bundle.lua:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003ebuild/bundle.lua\u003c/code\u003e autogenerated file\u003c/summary\u003e\n\n```lua\n--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]\n\nlocal ____modules = {}\nlocal ____moduleCache = {}\nlocal ____originalRequire = require\nlocal function require(file, ...)\n    if ____moduleCache[file] then\n        return ____moduleCache[file].value\n    end\n    if ____modules[file] then\n        local module = ____modules[file]\n        ____moduleCache[file] = { value = (select(\"#\", ...) \u003e 0) and module(...) or module(file) }\n        return ____moduleCache[file].value\n    else\n        if ____originalRequire then\n            return ____originalRequire(file)\n        else\n            error(\"module '\" .. file .. \"' not found\")\n        end\n    end\nend\n____modules = {\n[\"src.index\"] = function(...) \n--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]\nfunction onLoad(saveData)\n    local cube = getObjectFromGUID(\"c1a0d1\")\n    cube.interactable = false\n    cube.setLock(true)\nend\n end,\n}\nreturn require(\"src.index\", ...)\n```\n\n\u003c/details\u003e\n\nI use this to copy it in automatically (package.json):\n\n```json\n\"scripts\": {\n    \"compile\": \"tstl \u0026\u0026 npm run deploy\",\n    \"deploy\": \"copy \\\"build\\\\bundle.lua\\\" \\\"%LOCALAPPDATA%\\\\Temp\\\\TabletopSimulator\\\\Tabletop Simulator Lua\\\\Global.-1.lua\\\"\"\n}\n```\n\nSo I can simply use `npm run compile`\n\n### Contributing (TODO)\n\n- Finish tests\n- Create example projects\n\n### Development\n\n1. Clone\n2. `npm install`\n3. `npm run build` to build the project\n4. `npm run test` to run tests","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenlafl%2Ftts-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevenlafl%2Ftts-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenlafl%2Ftts-typescript/lists"}