diff --git a/sol/coroutine.hpp b/sol/coroutine.hpp index 57727936..cbfd0b5f 100644 --- a/sol/coroutine.hpp +++ b/sol/coroutine.hpp @@ -57,15 +57,15 @@ private: } template - void invoke(lua_State* Lthread, types, std::index_sequence, std::ptrdiff_t n) { + void invoke(types, std::index_sequence, std::ptrdiff_t n) { luacall(n, 0); } - protected_function_result invoke(lua_State* Lthread, types<>, std::index_sequence<>, std::ptrdiff_t n) { - int stacksize = lua_gettop( Lthread ); + protected_function_result invoke(types<>, std::index_sequence<>, std::ptrdiff_t n) { + int stacksize = lua_gettop( lua_state() ); int firstreturn = std::max( 1, stacksize - static_cast( n ) ); luacall(n, LUA_MULTRET); - int poststacksize = lua_gettop( Lthread ); + int poststacksize = lua_gettop(lua_state()); int returncount = poststacksize - (firstreturn - 1); return protected_function_result( lua_state( ), firstreturn, returncount, returncount, status() ); } @@ -108,7 +108,7 @@ public: decltype(auto) call( Args&&... args ) { push(); int pushcount = stack::push_args( lua_state(), std::forward( args )... ); - return invoke( lua_state(), types( ), std::index_sequence_for(), pushcount ); + return invoke( types( ), std::index_sequence_for(), pushcount ); } }; } diff --git a/sol/stack.hpp b/sol/stack.hpp index 8b5fd844..517cd0df 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -900,12 +900,17 @@ inline void luajit_exception_handler(lua_State* L, int(*handler)(lua_State*, lua lua_pushlightuserdata(L, (void*)handler); luaJIT_setmode(L, -1, LUAJIT_MODE_WRAPCFUNC | LUAJIT_MODE_ON); lua_pop(L, 1); +#else + (void)L; + (void)handler; #endif } inline void luajit_exception_off(lua_State* L) { #ifdef SOL_LUAJIT luaJIT_setmode(L, -1, LUAJIT_MODE_WRAPCFUNC | LUAJIT_MODE_OFF); +#else + (void)L; #endif } } // stack