@tilua-types/roblox 4.2.0 → 5.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.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/index.d.tilua +56 -76
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @tilua-types/roblox
2
2
 
3
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`,
4
+ (633), data type, service and global, plus what Luau adds to Lua —
5
5
  `buffer`, `bit32`, `utf8`, `table.create`, `string.split`, `math.clamp`, ...
6
6
 
7
7
  Luau is Roblox's language, so the two ship together. Underneath is
@@ -27,7 +27,8 @@ tree, down to `script.Parent`.
27
27
  `declare class` (`Part extends FormFactorPart extends BasePart ...`). A
28
28
  `Part` passes wherever a `BasePart` or `Instance` is expected, but a
29
29
  `Folder` does not pass as a `Part`, and a table never passes as an
30
- `Instance`. `typeof(instance)` is `"Instance"`.
30
+ `Instance`. `typeof instance` is `"Instance"`: `TypeofNames` tells the
31
+ language's `typeof` what each Roblox value answers.
31
32
  - **Events with typed arguments.** In `Players.PlayerAdded:Connect(function(player) ... end)`,
32
33
  `player` is a `Player`. Callbacks assigned to a property, such as
33
34
  `remote.OnServerInvoke = function(player, ...)`, are typed the same way.
package/index.d.tilua CHANGED
@@ -11,13 +11,13 @@
11
11
  --
12
12
  -- Every Roblox type is a `declare class`: nominal, the way the engine sees it.
13
13
  -- A `Part` is an `Instance` because it extends one, and a table is never a
14
- -- `Part`. Classes are not tables, so `typeof(part)` is "Instance".
14
+ -- `Part`. Classes are not tables, so `typeof part` is "Instance".
15
15
  --
16
16
  -- `inst:IsA("Model")`, `game:GetService("Players")` and `Instance.new("Part")`
17
17
  -- are generic signatures over the maps at the end of this file: `K` infers the
18
18
  -- string literal that was passed, and the map gives back its class.
19
19
  --
20
- -- The file opens with what Luau adds to Lua 5.1 (`typeof`, `buffer`, `bit32`,
20
+ -- The file opens with what Luau adds to Lua 5.1 (`buffer`, `bit32`,
21
21
  -- ...), copied from scripts/luau.d.tilua — Luau is Roblox's, so they ship
22
22
  -- together. The Lua 5.1 standard library underneath is `@tilua-types/lua`.
23
23
 
@@ -32,28 +32,6 @@
32
32
  --
33
33
  -- Edit this file, then regenerate the Roblox definitions.
34
34
 
35
- -- ============================================================
36
- -- `typeof()`
37
- -- ------------------------------------------------------------
38
- -- Luau's own: `type()`'s answers plus the Roblox data types further down this
39
- -- file, which it reports by name rather than as `userdata`. Narrowing works
40
- -- exactly as it does for `type()` — see `@tilua-types/lua` for how the overloads
41
- -- drive it.
42
- -- ============================================================
43
-
44
- declare function typeof(value: nil): "nil"
45
- declare function typeof(value: boolean): "boolean"
46
- declare function typeof(value: number): "number"
47
- declare function typeof(value: string): "string"
48
- declare function typeof(value: thread): "thread"
49
- declare function typeof(value: buffer): "buffer"
50
- declare function typeof(value: (...args: unknown[]) => unknown): "function"
51
- declare function typeof(value: { [unknown]: unknown }): "table"
52
- declare function typeof<T>(value: T): string
53
-
54
- -- Luau's `type()` knows one answer Lua's does not.
55
- declare function type(value: buffer): "buffer"
56
-
57
35
  -- ============================================================
58
36
  -- Base library
59
37
  -- ============================================================
@@ -8945,7 +8923,7 @@ declare class Instance extends Object {
8945
8923
  UniqueId: UniqueId,
8946
8924
  AddTag: (self: Instance, tag: string) => nil,
8947
8925
  ClearAllChildren: (self: Instance) => nil,
8948
- Clone: (self: Instance) => Instance,
8926
+ Clone: <T extends Instance>(self: T) => T,
8949
8927
  Destroy: (self: Instance) => nil,
8950
8928
  FindFirstAncestor: <T = Instance>(self: Instance, name: string) => T | nil,
8951
8929
  FindFirstAncestorOfClass: <K extends keyof ClassMap>(self: Instance, className: K) => ClassMap[K] | nil,
@@ -19817,54 +19795,56 @@ type CreatableClassMap = {
19817
19795
  WrapTextureTransfer: WrapTextureTransfer,
19818
19796
  }
19819
19797
 
19820
- -- `type()` is "userdata" for every Roblox type; `typeof()` names the data
19821
- -- type, or says "Instance", "EnumItem", ... These add to the overloads in
19822
- -- the Luau layer above, and a class is never a table, so none of them is
19823
- -- "table".
19824
- declare function type(value: Axes | BrickColor | CFrame | CatalogSearchParams | Color3 | ColorSequence | ColorSequenceKeypoint | Content | DateTime | DockWidgetPluginGuiInfo | Faces | FloatCurveKey | Font | InstanceHandle | NumberRange | NumberSequence | NumberSequenceKeypoint | OverlapParams | Path2DControlPoint | PathWaypoint | PhysicalProperties | RBXScriptConnection | Random | Ray | RaycastParams | Rect | Region3 | Region3int16 | RotationCurveKey | Secret | SecurityCapabilities | SharedTable | TweenInfo | UDim | UDim2 | User | ValueCurveKey | Vector2 | Vector2int16 | Vector3 | Vector3int16 | Object | EnumItem | Enum | Enums): "userdata"
19825
- declare function typeof(value: Axes): "Axes"
19826
- declare function typeof(value: BrickColor): "BrickColor"
19827
- declare function typeof(value: CFrame): "CFrame"
19828
- declare function typeof(value: CatalogSearchParams): "CatalogSearchParams"
19829
- declare function typeof(value: Color3): "Color3"
19830
- declare function typeof(value: ColorSequence): "ColorSequence"
19831
- declare function typeof(value: ColorSequenceKeypoint): "ColorSequenceKeypoint"
19832
- declare function typeof(value: Content): "Content"
19833
- declare function typeof(value: DateTime): "DateTime"
19834
- declare function typeof(value: DockWidgetPluginGuiInfo): "DockWidgetPluginGuiInfo"
19835
- declare function typeof(value: Faces): "Faces"
19836
- declare function typeof(value: FloatCurveKey): "FloatCurveKey"
19837
- declare function typeof(value: Font): "Font"
19838
- declare function typeof(value: InstanceHandle): "InstanceHandle"
19839
- declare function typeof(value: NumberRange): "NumberRange"
19840
- declare function typeof(value: NumberSequence): "NumberSequence"
19841
- declare function typeof(value: NumberSequenceKeypoint): "NumberSequenceKeypoint"
19842
- declare function typeof(value: OverlapParams): "OverlapParams"
19843
- declare function typeof(value: Path2DControlPoint): "Path2DControlPoint"
19844
- declare function typeof(value: PathWaypoint): "PathWaypoint"
19845
- declare function typeof(value: PhysicalProperties): "PhysicalProperties"
19846
- declare function typeof(value: RBXScriptConnection): "RBXScriptConnection"
19847
- declare function typeof(value: Random): "Random"
19848
- declare function typeof(value: Ray): "Ray"
19849
- declare function typeof(value: RaycastParams): "RaycastParams"
19850
- declare function typeof(value: Rect): "Rect"
19851
- declare function typeof(value: Region3): "Region3"
19852
- declare function typeof(value: Region3int16): "Region3int16"
19853
- declare function typeof(value: RotationCurveKey): "RotationCurveKey"
19854
- declare function typeof(value: Secret): "Secret"
19855
- declare function typeof(value: SecurityCapabilities): "SecurityCapabilities"
19856
- declare function typeof(value: SharedTable): "SharedTable"
19857
- declare function typeof(value: TweenInfo): "TweenInfo"
19858
- declare function typeof(value: UDim): "UDim"
19859
- declare function typeof(value: UDim2): "UDim2"
19860
- declare function typeof(value: User): "User"
19861
- declare function typeof(value: ValueCurveKey): "ValueCurveKey"
19862
- declare function typeof(value: Vector2): "Vector2"
19863
- declare function typeof(value: Vector2int16): "Vector2int16"
19864
- declare function typeof(value: Vector3): "Vector3"
19865
- declare function typeof(value: Vector3int16): "Vector3int16"
19866
- declare function typeof(value: Instance): "Instance"
19867
- declare function typeof(value: Object): "Object"
19868
- declare function typeof(value: EnumItem): "EnumItem"
19869
- declare function typeof(value: Enum): "Enum"
19870
- declare function typeof(value: Enums): "Enums"
19798
+ -- What `typeof` answers for a Roblox value: the data type's own name, or
19799
+ -- "Instance", "EnumItem", ... Each property is the name `typeof` gives a
19800
+ -- value of the property's type, and a value several of them fit — a `Part`
19801
+ -- is an `Instance` and an `Object` — is the first one's. A class is never a
19802
+ -- table, so none of these is an "array" or an "object".
19803
+ type TypeofNames = {
19804
+ Axes: Axes,
19805
+ BrickColor: BrickColor,
19806
+ CFrame: CFrame,
19807
+ CatalogSearchParams: CatalogSearchParams,
19808
+ Color3: Color3,
19809
+ ColorSequence: ColorSequence,
19810
+ ColorSequenceKeypoint: ColorSequenceKeypoint,
19811
+ Content: Content,
19812
+ DateTime: DateTime,
19813
+ DockWidgetPluginGuiInfo: DockWidgetPluginGuiInfo,
19814
+ Faces: Faces,
19815
+ FloatCurveKey: FloatCurveKey,
19816
+ Font: Font,
19817
+ InstanceHandle: InstanceHandle,
19818
+ NumberRange: NumberRange,
19819
+ NumberSequence: NumberSequence,
19820
+ NumberSequenceKeypoint: NumberSequenceKeypoint,
19821
+ OverlapParams: OverlapParams,
19822
+ Path2DControlPoint: Path2DControlPoint,
19823
+ PathWaypoint: PathWaypoint,
19824
+ PhysicalProperties: PhysicalProperties,
19825
+ RBXScriptConnection: RBXScriptConnection,
19826
+ Random: Random,
19827
+ Ray: Ray,
19828
+ RaycastParams: RaycastParams,
19829
+ Rect: Rect,
19830
+ Region3: Region3,
19831
+ Region3int16: Region3int16,
19832
+ RotationCurveKey: RotationCurveKey,
19833
+ Secret: Secret,
19834
+ SecurityCapabilities: SecurityCapabilities,
19835
+ SharedTable: SharedTable,
19836
+ TweenInfo: TweenInfo,
19837
+ UDim: UDim,
19838
+ UDim2: UDim2,
19839
+ User: User,
19840
+ ValueCurveKey: ValueCurveKey,
19841
+ Vector2: Vector2,
19842
+ Vector2int16: Vector2int16,
19843
+ Vector3: Vector3,
19844
+ Vector3int16: Vector3int16,
19845
+ Instance: Instance,
19846
+ Object: Object,
19847
+ EnumItem: EnumItem,
19848
+ Enum: Enum,
19849
+ Enums: Enums,
19850
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tilua-types/roblox",
3
- "version": "4.2.0",
3
+ "version": "5.0.0",
4
4
  "description": "Luau and the whole Roblox API as tilua types: every class, enum, data type, service and global",
5
5
  "license": "ISC",
6
6
  "files": [
@@ -18,7 +18,7 @@
18
18
  "@tilua/parser": "^3.1.0"
19
19
  },
20
20
  "dependencies": {
21
- "@tilua-types/lua": "^4.1.0"
21
+ "@tilua-types/lua": "^5.0.0"
22
22
  },
23
23
  "keywords": [
24
24
  "tilua",