Lua-API++  2015-02-12-3
Lua-API++ library
Value Class Referencefinal

Owner of a single stack slot. More...

Inheritance diagram for Value:
Valref

Public Member Functions

Life cycle
 Value (Valref src)
 Create a copy of referenced value.
 
 Value (Valobj src, Context &context)
 Promote native value.
 
 Value (Temporary src)
 Take ownership of expression result.
 
Valueoperator= (Valobj newValue)
 Assign new value to owned stack slot.
 
 Value (Value &&)
 It is possible to return Value from functions. More...
 
 ~Value () noexcept
 
- Public Member Functions inherited from Valref
 Valref (const Valref &) noexcept=default
 Copy constructor. More...
 
template<typename ValueType >
Valrefoperator= (ValueType &&val)
 Assignment. More...
 
template<typename T >
cast () const
 Explicit checked conversion to supported types. More...
 
template<typename T >
optcast (const T &backupValue=T()) const noexcept
 Safe conversion to supported types [Lua 5.2- only]. More...
 
template<typename T >
to () const noexcept
 Unchecked conversion to supported types. More...
 
template<typename T >
to (const T &backupValue) const noexcept
 Safe conversion to supported types. More...
 
 operator bool () const
 
 operator int () const
 
 operator unsigned int () const
 
 operator long long () const
 
 operator unsigned long long () const
 
 operator float () const
 
 operator double () const
 
 operator CFunction () const
 
 operator LightUserData () const
 
 operator const char * () const
 
 operator std::string () const
 
template<typename T >
bool is () const noexcept
 Check if the value convertible to given type. More...
 
bool isInteger () const noexcept
 Check if the value is an integer number [Lua 5.3+ only] More...
 
ValueType type () const noexcept
 Actual type of referenced value.
 
bool operator== (Valobj &&rhs) const
 
bool operator!= (Valobj &&rhs) const
 
bool operator< (Valobj &&rhs) const
 
bool operator> (Valobj &&rhs) const
 
bool operator<= (Valobj &&rhs) const
 
bool operator>= (Valobj &&rhs) const
 
Temporary operator[] (Valobj &&index_) const noexcept
 Indexation.
 
template<typename... Args>
Temporary operator() (Args &&...args) const noexcept
 Natural call form. More...
 
template<typename... Args>
Temporary call (Args &&...args) const noexcept
 Call method. More...
 
template<typename... Args>
Temporary pcall (Args &&...args) const noexcept
 Protected call method. More...
 
Temporary upvalue (size_t index) const noexcept
 Upvalue access inside closures. More...
 
Valset getUpvalues () const noexcept
 Retrieve upvalues and their names. More...
 
ClosureInfo getClosureInfo () const noexcept
 Retrieve information about closure [Lua 5.2+ only]. More...
 
size_t getClosureInfo () const noexcept
 Retrieve information about closure [Lua 5.1 only]. More...
 
Temporary len () const noexcept
 Length [Lua 5.2+ only].
 
size_t rawlen () const noexcept
 Raw length (no metamethods) [Lua 5.2+ only].
 
size_t len () const noexcept
 Length [Lua 5.1 only].
 
Temporary mt () const noexcept
 Metatable. More...
 
Temporary linked () const noexcept
 Linked value [Lua 5.3+ only]. More...
 

Additional Inherited Members

Detailed Description

Owner of a single stack slot.

This is basically a Valref which allocates its own slot on creation and frees it when destroyed. Its purpose is to anchor some value for repeated use.

Note
It is impossible to create a Value with empty table using anonymous Table object as initializer. Use records or array instead.

Constructor & Destructor Documentation

Value ( Value &&  )

It is possible to return Value from functions.

The move constructor is not implemented so you're not allowed to actually move Value, but you can return Values from functions.

~Value ( )
noexcept

The owned slot is freed upon Value destruction.