23 using Map = std::unordered_map<std::string, SL::Function>;
31 template<
typename... Args>
32 static std::tuple<Args...>
45 const std::string& name,
48 virtual ~Base() =
default;
57 SL_SYMBOL std::size_t __getTop(State L);
58 SL_SYMBOL
bool __isNil(State L);
59 SL_SYMBOL
void __pop(State L, uint32_t n);
64 template<
typename... Args>
68 SL_ASSERT(detail::__getTop(L) ==
sizeof...(Args),
"Lua arguments do not match expected args.");
69 std::tuple<Args...> values;
70 Util::CompileTime::static_for<
sizeof...(Args)>([&](
auto n) {
71 SL_ASSERT(!detail::__isNil(L),
"Argument nil");
73 const std::size_t I = n;
74 const auto i =
sizeof...(Args) - I - 1;
75 using Type = Util::CompileTime::NthType<i, Args...>;
78 const auto count = detail::__getTop(L);
80 if (detail::__getTop(L) == count) detail::__pop(L, 1);
Definition TypeMap.hpp:19
Represents a base library package in a Lua script.
Definition Lib.hpp:19
static std::tuple< Args... > extractArgs(State L)
Helper function extracting a list of types arguments from a Lua stack.
Definition Lib.hpp:66
SL_SYMBOL void registerFunctions(SL::Runtime &runtime) const
Registers the functions in this library with the given runtime.
Represents a single Lua runtime.
Definition Runtime.hpp:17