0

I am working on a script. The script includes some functions. Every function has one url packet that query the server. The server returns the data in JSON format. To use this data I have included the JSON library.

The problem I am facing is each function calls the next function after it finishes executing its body.

Like:

When Function1 Finishes it calls function2
when Function2 Finishes it calls Function3...and so on

So in-between if one of the function fails the script stops executing further.

I have research about this on Google and found out that i have to implement a circular buffer but couldn't find any good example of it.

One of my friend pointed out me that call functions recursively is very bad idea. Is that right?

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Prakash.DTI
  • 913
  • 2
  • 9
  • 19

1 Answers1

0

It sounds like you're talking about a ring buffer. You can find an example implementation here.

celeritas
  • 2,191
  • 1
  • 17
  • 28