So i have a table:
/* eslint-disable prettier/prettier */
interface TowerLibraryInterface {
[key: string]: {
WalkSpeed: number;
Scale: number;
Health: number;
WaveSpawnRequirement: number;
},
}
const TowerLibrary: TowerLibraryInterface = {
Normal: {
WalkSpeed: 16,
Scale: 1,
Health: 20,
WaveSpawnRequirement: 1
},
Zombie: {
WalkSpeed: 10,
Scale: 1.5,
Health: 40,
WaveSpawnRequirement: 3
},
SpeedyZombie: {
WalkSpeed: 32,
Scale: 0.5,
Health: 5,
WaveSpawnRequirement: 5
},
}
export default TowerLibrary```
and I want to count the number of infexes in that table in another script, here's what the other script looks like:
```typescript
import TowerLibrary from "./TowerLibrary";
export function startWave(currentWave: number, enemysToSpawn: number) {
const mobListToSpawn = {}
const unitsToChooseFrom = 3 // What im looking for is something like (TowerLibrary.size() <-- to return the number of indexes) but i can't do that
let enemysLogged = 0
while (enemysLogged < enemysToSpawn) {
// Preferbaly i want to count the amount of units in the "unitsToChooseFrom" const so I can do the following:
let randomEnemyName = TowerLibrary[math.random(unitsToChooseFrom)].Name
}
}```
can someone wrtie a way for me to do that? so I can learn it thank you 🙂