Well, You remind me. Recently our project has upgraded to lua5.4. I found a traceback: attempt to call a nil value, when I call lua_remove in a function (the function is invoked in lua).
The C stack is lua_remove -> lua_pop -> lua_settop -> luaF_close -> prepcallclosemth -> callclosemethod
I'm sure we have no to-be-closed variables yet.
I'll continue to figure it out And try to reproduce the traceback.