5#ifndef NNGN_LUA_VALUE_H
6#define NNGN_LUA_VALUE_H
39 template<
typename R = value_view> R
push(
void)
const;
41 explicit operator T(
void)
const {
return this->
get<T>(); }
58 template<
typename R = value>
79 return this->
state().get<
T>(this->index());
85 return {this->
state(), lua_gettop(this->
state())};
96 const char *
s = luaL_tolstring(*
this,
i, &
n);
98 value{*
this, lua_gettop(*
this)},
99 std::string_view{
s,
n},
113template<std::derived_from<value> T>
116static_assert(detail::stack_type<value_view>);
117static_assert(detail::stack_type<value>);
state
Definition cathedral.lua:13
T get(int i) const
Reads a value from the stack.
Definition state.h:230
state_view release(void)
Definition state.h:105
std::pair< value, std::string_view > to_string(int i) const
Pushes a string representation of a value onto the stack.
Definition value.h:94
void remove(int i) const
Definition state.h:152
Base, non-owning generic stack value reference.
Definition value.h:18
type get_type(void) const
Type of value at index i.
Definition value.h:63
T get(void) const
Definition value.h:78
void get(lua_State *L, int i)
Definition value.h:36
state_view m_state
Definition value.h:43
state_view release(void)
Definition value.h:26
int push(void) const
Definition value.h:71
~value_view(void)=default
int index(void) const
Lua stack index.
Definition value.h:28
value_view(state_view l, int i)
Definition value.h:22
bool is_nil(void) const
Definition value.h:32
int m_index
Definition value.h:44
auto to_string(void) const
Definition value.h:67
state_view state(void) const
Definition value.h:24
for i
Definition font.lua:5
local n
Definition dump_lights.lua:5
local l
Definition light.lua:23
constexpr bool can_get
Whether this library knows how to read a T value from the stack.
Definition lua.h:183
Definition lua_audio.cpp:19
constexpr bool is_stack_ref< T >
Definition table.h:452
type
LUA_T* constants as a scoped enumeration.
Definition lua.h:77
operator==(T &&lhs, const table_proxy< PT, Ks... > &rhs)
Definition table.h:346
v[1]
Definition math.lua:22
#define NNGN_DEFAULT_CONSTRUCT(x)
Definition utils.h:20
#define NNGN_NO_COPY(x)
Definition utils.h:35
#define FWD(...)
Definition utils.h:18
Owning stack value reference.
Definition value.h:48
value remove(void)
Definition value.h:60
R push(void) const
Definition value.h:59
~value(void)
Definition value.h:54
value_view release(void)
Definition value.h:56
value(const value &)=delete
value(value &&rhs) noexcept
Definition value.h:52
value(value_view v)
Definition value.h:51
value & operator=(const value &)=delete
std::chrono::seconds s
Definition timing.cpp:6