64#ifndef NNGN_LUA_FUNCTION_H
65#define NNGN_LUA_FUNCTION_H
86template<
typename CRTP>
114template<
typename CRTP>
117 const auto &crtp =
static_cast<const CRTP&
>(*this);
118 crtp.state().call(crtp,
FWD(args)...);
124template<
typename R,
typename ...Args>
125R
call(lua_State *L, R(*
f)(Args...),
int i) {
130template<
typename R,
typename T,
typename ...Args>
136template<
typename R,
typename T,
typename ...Args>
138 return std::apply(
f, stack_get<std::tuple<const T&, Args...>>
::get(L,
i));
142template<stateless_lambda T>
143decltype(
auto)
call(lua_State *L,
T,
int i) {
147static_assert(detail::stack_type<function_view>);
148static_assert(detail::stack_type<function_value>);
local class const
Definition animation.lua:7
Base, non-owning generic stack value reference.
Definition value.h:18
precision highp int
Definition common.h:14
for i
Definition font.lua:5
#define NNGN_LOG_CONTEXT_CF(c)
Definition log.h:11
Definition lua_audio.cpp:19
R call(lua_State *L, R(*f)(Args...), int i)
Calls the regular function f with arguments taken from the stack.
Definition function.h:125
Functions for pushing values onto the stack.
get
Definition camera.lua:46
General utilities for stack manipulation.
#define FWD(...)
Definition utils.h:18
#define NNGN_MOVE_ONLY(x)
Definition utils.h:39
Reference to a function on the stack.
Definition function.h:87
void operator()(auto &&...args) const
Pushes each argument onto the stack and calls the function.
Definition function.h:115
Owning reference to a function on the stack.
Definition function.h:106
~function_value(void)=default
Non-owning reference to a function on the stack.
Definition function.h:98
Reads a value from the Lua stack.
Definition lua.h:118
Owning stack value reference.
Definition value.h:48
value(const value &)=delete
Operations on generic stack values.