public static DebuggableScript[] getAllFunctions(DebuggableScript function) { ObjArray functions = new ObjArray(); collectFunctions(function, functions); DebuggableScript[] result = new DebuggableScript[functions.size()]; functions.toArray(result); return result; }
private static void collectFunctions(DebuggableScript function, ObjArray array) { array.add(function); for (int i = 0; i != function.getFunctionCount(); ++i) { collectFunctions(function.getFunction(i), array); } }