lua-users home
lua-l archive

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

So it goes - work on a problem for days, and then just after reaching out the solution comes to me.

I think the problem was a misunderstanding of the from parameter in lua_resume which was formerly harmless. Changing that value from the coroutine itself to NULL fixes the problem - this is being resumed by sdl events not a coroutine.

I'm still hitting some other lua 5.4 specific issues but I will continue to evaluate them on a case by case.


Stephen E. Baker

On Sat, Jul 4, 2020 at 10:50 PM Stephen E. Baker <> wrote:

I've been trying to add compatibility with Lua 5.4 to the open source game engine CorsixTH. My patch to date can be seen here:

This version still works with 5.3 (and 5.2, 5.1, and LuaJIT 2) but with 5.4 I am getting:

C stack overflow
stack traceback:
        [C]: in function 'coroutine.yield'
        /home/stephen/corsixth/CorsixTH/Lua/app.lua:1011: in function </home/stephen/corsixth/CorsixTH/Lua/app.lua:1006>

Many other things don't seem to be functioning correctly either. It's admittedly a large code base, but I don't believe we are impacted by the other listed incompatibilities.

Debugging shows that the stack size is consistently the same size as the nres of lua_resume. The error always happens after 195 resume calls; regardless of whether those are events, frames, or timers.

I'm at a bit of a loss on how to debug the problem further, or where to look/why is the stack size growing in Lua 5.4 when it wasn't in earlier versions?