@rbxts/prototype 0.0.6 → 0.0.7
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/out/prototype.d.ts +2 -0
- package/out/prototype.lua +14 -0
- package/package.json +1 -1
package/out/prototype.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ export declare class PrototypeHandler {
|
|
|
62
62
|
/** @metadata macro */
|
|
63
63
|
Index<T extends IPrototype>(prototypeId: string, kindName?: Modding.Generic<T, "text"> | string): T;
|
|
64
64
|
Index(prototypeId: string, kindName: string): IPrototype;
|
|
65
|
+
/** @metadata macro */
|
|
66
|
+
IndexAll<T extends IPrototype>(kindName?: Modding.Generic<T, "text"> | string): T[];
|
|
65
67
|
Compile(): void;
|
|
66
68
|
RegisterPrototype(prototype: IPrototype, kindName: string): void;
|
|
67
69
|
}
|
package/out/prototype.lua
CHANGED
|
@@ -412,6 +412,20 @@ do
|
|
|
412
412
|
local _prototypeId_1 = prototypeId
|
|
413
413
|
return _instances_1[_prototypeId_1].Instance
|
|
414
414
|
end
|
|
415
|
+
function PrototypeHandler:IndexAll(kindName)
|
|
416
|
+
local _prototypes = self.prototypes
|
|
417
|
+
local _kindName = kindName
|
|
418
|
+
local kind = _prototypes[_kindName]
|
|
419
|
+
if not kind then
|
|
420
|
+
error(`Prototype with kind key: {kindName} does not exist`)
|
|
421
|
+
end
|
|
422
|
+
local instances = {}
|
|
423
|
+
for _, instanceData in pairs(kind.Instances) do
|
|
424
|
+
local _instance = instanceData.Instance
|
|
425
|
+
table.insert(instances, _instance)
|
|
426
|
+
end
|
|
427
|
+
return instances
|
|
428
|
+
end
|
|
415
429
|
function PrototypeHandler:Compile()
|
|
416
430
|
local ids = {}
|
|
417
431
|
for id, Kind in self.allRegisteredPrototypes do
|