From c07bbd248cfecc1f91ef7988df0d68030cfdc45a Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 27 Feb 2016 02:49:40 -0500 Subject: [PATCH] Formatting and a few new constants. --- sol/coroutine.hpp | 16 ++++++++-------- sol/reference.hpp | 6 +++--- sol/state.hpp | 2 +- sol/table_core.hpp | 4 ++-- sol/thread.hpp | 10 +++++----- sol/types.hpp | 14 +++++++------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sol/coroutine.hpp b/sol/coroutine.hpp index a6dd987e..57727936 100644 --- a/sol/coroutine.hpp +++ b/sol/coroutine.hpp @@ -32,21 +32,21 @@ class coroutine : public reference { private: call_status stats = call_status::yielded; - void luacall( std::ptrdiff_t argcount, std::ptrdiff_t ) { -#if SOL_LUA_VERSION < 503 + void luacall(std::ptrdiff_t argcount, std::ptrdiff_t) { +#if SOL_LUA_VERSION < 502 stats = static_cast(lua_resume(lua_state(), static_cast(argcount))); #else stats = static_cast(lua_resume(lua_state(), nullptr, static_cast(argcount))); -#endif // Lua 5.3 +#endif // Lua 5.1 compat } template auto invoke( types, std::index_sequence, std::ptrdiff_t n ) { luacall(n, sizeof...(Ret)); - int stacksize = lua_gettop(lua_state()); - int firstreturn = std::max(1, stacksize - static_cast(sizeof...(Ret)) + 1); - auto r = stack::get>(lua_state(), firstreturn); - lua_pop(lua_state(), static_cast(sizeof...(Ret))); + int stacksize = lua_gettop(lua_state()); + int firstreturn = std::max(1, stacksize - static_cast(sizeof...(Ret)) + 1); + auto r = stack::get>(lua_state(), firstreturn); + lua_pop(lua_state(), static_cast(sizeof...(Ret))); return r; } @@ -106,7 +106,7 @@ public: template decltype(auto) call( Args&&... args ) { - push(); + push(); int pushcount = stack::push_args( lua_state(), std::forward( args )... ); return invoke( lua_state(), types( ), std::index_sequence_for(), pushcount ); } diff --git a/sol/reference.hpp b/sol/reference.hpp index a28a48ba..5c8a1c34 100644 --- a/sol/reference.hpp +++ b/sol/reference.hpp @@ -61,8 +61,8 @@ private: protected: reference(lua_State* L, detail::global_tag) : L(L) { - lua_pushglobaltable(L); - ref = luaL_ref(L, LUA_REGISTRYINDEX); + lua_pushglobaltable(L); + ref = luaL_ref(L, LUA_REGISTRYINDEX); } public: @@ -124,7 +124,7 @@ public: } explicit operator bool () const { - return valid(); + return valid(); } type get_type() const { diff --git a/sol/state.hpp b/sol/state.hpp index 9874aefb..ca3ecd8d 100644 --- a/sol/state.hpp +++ b/sol/state.hpp @@ -32,7 +32,7 @@ public: state(lua_CFunction panic = detail::atpanic) : unique_base(luaL_newstate(), lua_close), state_view(unique_base::get()) { set_panic(panic); - sol::stack::luajit_exception_handler(unique_base::get()); + sol::stack::luajit_exception_handler(unique_base::get()); } using state_view::get; diff --git a/sol/table_core.hpp b/sol/table_core.hpp index 32a6824d..b27df384 100644 --- a/sol/table_core.hpp +++ b/sol/table_core.hpp @@ -41,7 +41,7 @@ class table_core : public reference { -> decltype(stack::pop>(nullptr)){ auto pp = stack::push_pop(keys))...>::value>(*this); int tableindex = lua_gettop(lua_state()); - void(detail::swallow{ ( stack::get_field(lua_state(), std::get(keys), tableindex), 0)... }); + void(detail::swallow{ ( stack::get_field(lua_state(), std::get(keys), tableindex), 0)... }); return stack::pop>( lua_state() ); } @@ -55,7 +55,7 @@ class table_core : public reference { template void tuple_set( std::index_sequence, Pairs&& pairs ) { auto pp = stack::push_pop(pairs))...>::value>(*this); - void(detail::swallow{ (stack::set_field(lua_state(), std::get(pairs), std::get(pairs)), 0)... }); + void(detail::swallow{ (stack::set_field(lua_state(), std::get(pairs), std::get(pairs)), 0)... }); } template diff --git a/sol/thread.hpp b/sol/thread.hpp index 0f82df17..28c92b49 100644 --- a/sol/thread.hpp +++ b/sol/thread.hpp @@ -37,17 +37,17 @@ public: lua_State* thread_state () const { auto pp = stack::push_pop(*this); lua_State* lthread = lua_tothread(lua_state(), -1); - return lthread; + return lthread; } thread_status status () const { lua_State* lthread = thread_state(); thread_status lstat = static_cast(lua_status(lthread)); - if (lstat != thread_status::normal && lua_gettop(lthread) == 0) { + if (lstat != thread_status::normal && lua_gettop(lthread) == 0) { // No thing on the thread's stack means its dead - return thread_status::dead; - } - return lstat; + return thread_status::dead; + } + return lstat; } static thread create (lua_State* L) { diff --git a/sol/types.hpp b/sol/types.hpp index c63c6991..8b802cb8 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -77,13 +77,13 @@ enum class call_status : int { }; enum class thread_status : int { - normal = LUA_OK, - yielded = LUA_YIELD, - error_runtime = LUA_ERRRUN, - error_memory = LUA_ERRMEM, - error_gc = LUA_ERRGCMM, - error_handler = LUA_ERRERR, - dead, + normal = LUA_OK, + yielded = LUA_YIELD, + error_runtime = LUA_ERRRUN, + error_memory = LUA_ERRMEM, + error_gc = LUA_ERRGCMM, + error_handler = LUA_ERRERR, + dead, }; enum class type : int {