aboutsummaryrefslogtreecommitdiff
path: root/src/compat.hpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-12-03 10:26:47 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2024-12-03 10:26:47 +0100
commit307fd830eb168005a3ba3d557343284814757eff (patch)
treeeb14512492d58e33585bc5df3f3d9b23d7308934 /src/compat.hpp
parentca7657e24549acb8a2dd45fa81c309b5bf9f61ee (diff)
downloadlanes-307fd830eb168005a3ba3d557343284814757eff.tar.gz
lanes-307fd830eb168005a3ba3d557343284814757eff.tar.bz2
lanes-307fd830eb168005a3ba3d557343284814757eff.zip
New method linda:restrict()
Diffstat (limited to 'src/compat.hpp')
-rw-r--r--src/compat.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compat.hpp b/src/compat.hpp
index f66f703..81f1665 100644
--- a/src/compat.hpp
+++ b/src/compat.hpp
@@ -272,6 +272,16 @@ LuaType luaG_getmodule(lua_State* L_, std::string_view const& name_);
272 272
273// ################################################################################################# 273// #################################################################################################
274 274
275template<typename ENUM>
276requires std::is_enum_v<ENUM>
277[[nodiscard]]
278ENUM luaG_optenum(lua_State* const L_, StackIndex const idx_, ENUM const def_)
279{
280 return static_cast<ENUM>(luaL_optinteger(L_, idx_, static_cast<std::underlying_type_t<ENUM>>(def_)));
281}
282
283// #################################################################################################
284
275inline void luaG_registerlibfuncs(lua_State* L_, luaL_Reg const* funcs_) 285inline void luaG_registerlibfuncs(lua_State* L_, luaL_Reg const* funcs_)
276{ 286{
277 // fake externs to make clang happy... 287 // fake externs to make clang happy...