diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-12-03 10:26:47 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-12-03 10:26:47 +0100 |
commit | 307fd830eb168005a3ba3d557343284814757eff (patch) | |
tree | eb14512492d58e33585bc5df3f3d9b23d7308934 /src/compat.hpp | |
parent | ca7657e24549acb8a2dd45fa81c309b5bf9f61ee (diff) | |
download | lanes-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.hpp | 10 |
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 | ||
275 | template<typename ENUM> | ||
276 | requires std::is_enum_v<ENUM> | ||
277 | [[nodiscard]] | ||
278 | ENUM 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 | |||
275 | inline void luaG_registerlibfuncs(lua_State* L_, luaL_Reg const* funcs_) | 285 | inline 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... |