@tilua-types/roblox 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @tilua-types/roblox
2
+
3
+ Luau and the whole Roblox API as tilua types: every class (921 of them), enum
4
+ (633), data type, service and global, plus what Luau adds to Lua — `typeof`,
5
+ `buffer`, `bit32`, `utf8`, `table.create`, `string.split`, `math.clamp`, ...
6
+
7
+ Luau is Roblox's language, so the two ship together. Underneath is
8
+ [`@tilua-types/lua`](../lua), the Lua 5.1 standard library, which this depends
9
+ on and is loaded along with it — so this is the only package a Roblox project
10
+ installs.
11
+
12
+ ```bash
13
+ npm i -D @tilua-types/roblox
14
+ ```
15
+
16
+ ```json
17
+ { "types": ["roblox"], "paths": {}, "sourceMap": "sourcemap.json" }
18
+ ```
19
+
20
+ With `sourceMap` pointing at a Rojo sourcemap (`rojo sourcemap -o sourcemap.json`),
21
+ `game`, `workspace` and each file's `script` are typed from the real instance
22
+ tree, down to `script.Parent`.
23
+
24
+ ## What you get
25
+
26
+ - **Classes with Roblox's own hierarchy.** Every type is a nominal
27
+ `declare class` (`Part extends FormFactorPart extends BasePart ...`). A
28
+ `Part` passes wherever a `BasePart` or `Instance` is expected, but a
29
+ `Folder` does not pass as a `Part`, and a table never passes as an
30
+ `Instance`. `typeof(instance)` is `"Instance"`.
31
+ - **Events with typed arguments.** In `Players.PlayerAdded:Connect(function(player) ... end)`,
32
+ `player` is a `Player`. Callbacks assigned to a property, such as
33
+ `remote.OnServerInvoke = function(player, ...)`, are typed the same way.
34
+ - **Enums.** `Enum.KeyCode.E` is an `Enum.KeyCode`, `Enum.Material` works as
35
+ a type, and one enum's items do not pass as another's.
36
+ - **Data types with their operators.** `Vector3 + Vector3`, `CFrame * Vector3`
37
+ and `2 * vector` get their types from the declared metamethods.
38
+ - **Names checked against the API.** `game:GetService("Players")`,
39
+ `inst:IsA("BasePart")` (which also narrows), `Instance.new("Part")` and
40
+ `FindFirstChildOfClass("Humanoid")` all return the class they name, and a
41
+ misspelt name is an error.
42
+
43
+ Deprecated members are left out. Deprecated globals such as `wait` and
44
+ `spawn` stay.
45
+
46
+ ## Where it comes from
47
+
48
+ `index.d.tilua` is generated. Don't edit it by hand; change
49
+ `scripts/generate-roblox.mjs` instead — or `scripts/luau.d.tilua`, the
50
+ hand-written Luau layer the generator copies into the head of the file. The generator converts the definitions
51
+ [luau-lsp](https://github.com/JohnnyMorganz/luau-lsp) builds from the Roblox
52
+ API dump, at a pinned commit, into tilua syntax. To pick up a newer API:
53
+
54
+ ```bash
55
+ npm run generate:roblox # the pinned commit
56
+ node scripts/generate-roblox.mjs --commit <luau-lsp commit> # a newer one
57
+ ```
58
+
59
+ luau-lsp is MIT licensed. Its notice is in
60
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,30 @@
1
+ # Third-party notices
2
+
3
+ `index.d.tilua` is generated from the Roblox definitions in
4
+ [luau-lsp](https://github.com/JohnnyMorganz/luau-lsp)
5
+ (`scripts/globalTypes.d.luau`), converted to tilua syntax by
6
+ `scripts/generate-roblox.mjs` in the tilua-types repository.
7
+
8
+ ## luau-lsp
9
+
10
+ MIT License
11
+
12
+ Copyright (c) 2022 JohnnyMorganz
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.