I heared that, if you have a program (for example: test) and in this program are some lines of code. at the end you restart it with shell.run('test').
Why is this "bad"?
Little question to shell.run()
Started by H4X0RZ, May 20 2013 04:54 AM
3 replies to this topic
#1
Posted 20 May 2013 - 04:54 AM
#2
Posted 20 May 2013 - 05:04 AM
Well I guess the easiest way for me to answer is to tell you to run this program and see what happens
program name: tester
yep thats right, stackoverflow. using shell.run at the end of your program to loop your program is recursion.
program name: tester
shell.run('tester')
yep thats right, stackoverflow. using shell.run at the end of your program to loop your program is recursion.
#3
Posted 20 May 2013 - 05:05 AM
So in other words, it's the same as doing this:
function toaster() toaster() end
#4
Posted 20 May 2013 - 06:34 AM
Reason: The stack in Lua is like a pile of clean dishes. Too many dishes and the stack crashes down. If a function yields however, it will be taken off the stack. Guess what, using recursion (in most cases) does not yield. So just don't use it if the situation you are using it in does not need it.
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











