Maybe better getInstance like this:
Edit. Performance of this code is O(1), but your code is O(n).
Squirrel Script
- function getInstance(id)
- {
- if (id >= 0 && id < List.len())
- return List[id]
-
- return null;
- };
Edit. Performance of this code is O(1), but your code is O(n).