From ee32d4281a5e59ce81d7f38f86a49fa8ff64d2c3 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 7 Jun 2024 11:46:25 +0200 Subject: Boyscouting some luaG_ functions --- src/macros_and_utils.h | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'src/macros_and_utils.h') diff --git a/src/macros_and_utils.h b/src/macros_and_utils.h index 338e389..3e0b425 100644 --- a/src/macros_and_utils.h +++ b/src/macros_and_utils.h @@ -31,33 +31,6 @@ inline void STACK_GROW(lua_State* L_, int n_) // ################################################################################################# -// a small helper to extract a full userdata pointer from the stack in a safe way -template -[[nodiscard]] T* lua_tofulluserdata(lua_State* L_, int index_) -{ - LUA_ASSERT(L_, lua_isnil(L_, index_) || lua_type(L_, index_) == LUA_TUSERDATA); - return static_cast(lua_touserdata(L_, index_)); -} - -template -[[nodiscard]] auto lua_tolightuserdata(lua_State* L_, int index_) -{ - LUA_ASSERT(L_, lua_isnil(L_, index_) || lua_islightuserdata(L_, index_)); - if constexpr (std::is_pointer_v) { - return static_cast(lua_touserdata(L_, index_)); - } else { - return static_cast(lua_touserdata(L_, index_)); - } -} - -template -[[nodiscard]] T* lua_newuserdatauv(lua_State* L_, int nuvalue_) -{ - return static_cast(lua_newuserdatauv(L_, sizeof(T), nuvalue_)); -} - -// ################################################################################################# - using lua_Duration = std::chrono::template duration; // ################################################################################################# -- cgit v1.2.3-55-g6feb