lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes, precisely. 'return factorial(3)' is the last line in my script. But what I see when I enter factorial() is

========= CALL STACK ============
Function 0: factorial() @../../scripts/factorial.lua, line: 11
===== END CALL STACK ============

What I expect to see is:

========= CALL STACK ============
Function 0: factorial() @../../scripts/factorial.lua, line: 11
Function 1: made tail call so its info is erased by Lua.
===== END CALL STACK ============

Where Function 1 would be main().

Do you know if chunks behave differently when making tail calls?

Tai

-----Original Message-----
From: RLake@oxfam.org.pe [mailto:RLake@oxfam.org.pe]
Sent: Monday, September 29, 2003 6:54 PM
To: Lua list
Subject: RE: Confused about proper tail calls


> Where main() -- the main chunk -- made a tail call to factorial(). Why 
is it that I don't see 

factorial(3) is not a tail call
return factorial(3) is a tail call