lua-users home
lua-l archive

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


I thought that the "level" parameter was supposed to shave some of the
call stack... What is happening here?

    ~$ lua
    Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > function foo(n) bar(n) end
    > function bar(n) error("BAR", n) end

    > foo(1)
    stdin:1: BAR
    stack traceback:
        [C]: in function 'error'
        stdin:1: in function 'bar'
        stdin:1: in function 'foo'
        stdin:1: in main chunk
        [C]: ?

    > foo(2)
    stdin:1: BAR
    stack traceback:
        [C]: in function 'error'
        stdin:1: in function 'bar'
        stdin:1: in function 'foo'
        stdin:1: in main chunk
        [C]: ?

    > foo(3)
    stdin:1: BAR
    stack traceback:
        [C]: in function 'error'
        stdin:1: in function 'bar'
        stdin:1: in function 'foo'
        stdin:1: in main chunk
        [C]: ?

    > foo(0)
    BAR
    stack traceback:
        [C]: in function 'error'
        stdin:1: in function 'bar'
        stdin:1: in function 'foo'
        stdin:1: in main chunk
        [C]: ?

—Pierre-Yves