lua-users home
lua-l archive

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


On Mon, Dec 17, 2018 at 8:44 PM actboy168 <actboy168@gmail.com> wrote:

local function test()

    test()

end

test()

 

In lua compiled in msvc2017, this code will cause a crash.

 

--actboy168


When you say crash, do you mean other than a normal Lua error and traceback? An error and traceback is to be expected with this code since infinite recursion like this will eventually overflow the call stack. This is what I get on Linux, compiled with gcc:

$ lua
Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> do
>> local function test()
>> test()
>> end
>> test()
>> end
stdin:3: stack overflow
stack traceback:
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    ...
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in upvalue 'test'
    stdin:3: in local 'test'
    stdin:5: in main chunk
    [C]: in ?

If that's what you're getting, then the behavior is correct. On the other hand, if you're getting a segmentation fault or some other strange non-Lua error, then I'm sure the Lua team would appreciate more details as to exactly what is occurring.