bugs
kcp_output_callback(...){
...
lua_call(L, 1, 0);
...
}
DO NOT invoke a lua function in callback(C) functions using L which was passed by lua call (this call may happen in coroutine).
you need try this:
lua_State mainState = get_main_state(L);
...
/push args*/
lua_pcall(mainState, narg, nret, err);
bugs
kcp_output_callback(...){
...
lua_call(L, 1, 0);
...
}
DO NOT invoke a lua function in callback(C) functions using L which was passed by lua call (this call may happen in coroutine).
you need try this:
lua_State mainState = get_main_state(L);
...
/push args*/
lua_pcall(mainState, narg, nret, err);