ValueBase internal class members
Boolean type used for Value constructor.
The native C++ bool type is not used here due to implicit cast between bool and pointers which prevent proper constructor overloading.
Identifier | Value | Description |
---|---|---|
False | 0 | |
True | 1 |
Specify lua operations performed on lua values.
Identifier | Description |
---|---|
OpAdd | Lua add binary operator + |
OpSub | Lua subtract binary operator - |
OpMul | Lua multiply binary operator * |
OpDiv | Lua divied binary operator / |
OpMod | Lua modulo binary operator % |
OpPow | Lua power binary operator ^ |
OpUnm | Lua negative unary operator - |
OpConcat | Lua concatenation binary operator .. |
OpLen | Lua length unary operator # |
OpEq | Lua equal binary operator == |
OpLt | Lua less than binary operator < |
OpLe | Lua less than or equal binary operator <= |
OpIndex | Table index operation |
OpNewindex | Table newindex operation |
OpCall | Function call operation |
OpIterate | Iteration operation |
OpAll | All operations mask |
See also UserData::meta_operation function, UserData::support function and ValueBase::Operations typedef.
typedef ValueBase::Operation Operations
No documentation available
Specify lua value types. This is the same as LUA_T* macros defined in lua headers
Identifier | Description |
---|---|
TNone | No type |
TNil | Nil value |
TBool | Boolean value |
TNumber | Number value |
TString | String value |
TTable | Lua table value |
TFunction | Lua function value |
TUserData | Lua userdata value |
TThread | Lua thread value |
Index operation on a lua userdata or lua table value.
template <typename T> Value at(const T &key) const
Index operation on a lua userdata or lua table value.
ValueBase::iterator begin()
Get an ValueBase::iterator to traverse a lua userdata or lua table value.
ValueBase::const_iterator begin() const
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::const_iterator cbegin() const
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
ValueBase::const_iterator cend() const
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
bool connect(QObject *obj, const char *signal)
Connect a QObject signal to a lua value. The value will be called when the signal is emited.
See also ValueBase::disconnect function, QObject::connect and QObject wrapping section.
bool disconnect(QObject *obj, const char *signal)
Disconnect a QObject signal from a lua value.
See also ValueBase::connect function, QObject::disconnect and QObject wrapping section.
ValueBase::iterator end()
Get an ValueBase::iterator to traverse a lua userdata or lua table value.
ValueBase::const_iterator end() const
Get a ValueBase::const_iterator to traverse a lua userdata or lua table value.
State * get_state() const
Get associated lua state.
Returns true if the value is a coroutine which is not resumable. This function always returns false if State::lua_version() returns a value less than 501.
Check if a table or userdata contains at leasts one entry. For lua tables this is different from comparing the result of the ValueBase::len function with zero because this function will return true even if the table keys are not integers.
Check if the value is nil
Return the lua len of tables and strings. Return the result of the ValueBase::OpLen operation on UserData objects if ValueBase::OpLen is supported.
Return an Iterator object suitable to iterate over lua value. This works for lua tables and UserData objects.
Convert a lua value to a boolean. Throw exception if conversion fails.
Create a QHash with elements from lua table.
See also Qt/Lua types conversion section.
Create a QList with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
Create a QMap with elements from lua table.
See also Qt/Lua types conversion section.
Convert a lua string value to a String object. Throw exception if conversion fails.
Convert a bool, string or number value to a QVariant. The ValueBase::to_qvariant alternate function can be used to attempt a conversion of the value to a specified registered Qt type.
See also Qt/Lua types conversion section.
Create a QVector with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
See ValueBase::to_userdata_cast function.
Convert a lua string value to a String object. Throw exception if conversion fails.
No documentation available
Convert a lua number value to a double. Throw exception if conversion fails.
Convert a lua number value to a double. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to an integer. Throw exception if conversion fails.
ValueBase::List operator()() const
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4) const
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5) const
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
ValueBase::List operator()(const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5, const Value &arg6) const
Call operation on a lua userdata or lua function value. When invoked on a lua thread value, the thread is resumed.
bool operator<(const Value &lv) const
Compare two lua values. This function may not give the same result as the lua compare operation depending on value type. This function is designed to be used by ordered containers like QMap. This function can compare values of different types and never fails.
bool operator==(const Value &lv) const
Compare two lua values. This function may not give the same result as the lua compare operation depending on value type. UserData values are considered equals if pointing to the same object. Other values are compared using the lua_rawequal function of the lua API. This function never fails.
bool operator==(const String &str) const
Compare the lua value with the given string.
Compare the lua value with the given C string.
Compare the lua value with the given number.
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
template <typename T> Value operator[](const T &key) const
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
template <typename T> ValueRef operator[](const T &key)
Index operation on a lua userdata or lua table value. The ValueBase::at function is prefered for read access on non-const objects because construction of a ValueRef is not needed.
This function starts execution of a lua thread value. Resume after yield can be performed by invocation of the ValueBase::call function.
bool support(ValueBase::Operation c) const
Check given operation support.
See also UserData::support function.
void table_shift(int pos, int count, const Value &init, int len = -1)
Make room in a lua table at given position if count > 0 or remove entries if count < 0.
Make room in a lua table at given position if count > 0 or remove entries if count < 0.
ValueBase::Bool to_boolean() const
Convert a lua value to a boolean. Throw exception if conversion fails.
QByteArray to_bytecode() const
Dump the bytecode for a function object
Convert a lua value into a Ref pointer to an UserData and perform a dynamic_cast<X*>. Throw exception if either conversion fails, pointer is null or cast fails.
See also ValueBase::to_class_cast_null function.
Convert a lua value into a Ref pointer to an UserData and perform a dynamic_cast<X*>. Throw exception if conversion or cast fails.
See also ValueBase::to_class_cast function.
Convert a lua number value to an integer. Throw exception if conversion fails.
Convert a lua number value to a double. Throw exception if conversion fails.
template <typename Key, typename Val> QHash<Key, Val> to_qhash() const
Create a QHash with elements from lua table.
See also Qt/Lua types conversion section.
template <typename X> QList<X> to_qlist() const
Create a QList with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
template <typename Key, typename Val> QMap<Key, Val> to_qmap() const
Create a QMap with elements from lua table.
See also Qt/Lua types conversion section.
QObject * to_qobject() const
Convert a lua value to a QObject pointer. Throw exception if conversion or cast fails.
See also ValueBase::to_qobject_cast function.
Convert a lua value to a QObject subclass pointer. Subclass must have the Q_OBJECT macro in it's definition. Throw exception if conversion or cast fails.
See also ValueBase::to_qobject function.
QString to_qstring() const
Convert a lua string value to a String object. Throw exception if conversion fails.
QVariant to_qvariant() const
Convert a bool, string or number value to a QVariant. The ValueBase::to_qvariant alternate function can be used to attempt a conversion of the value to a specified registered Qt type.
See also Qt/Lua types conversion section.
QVariant to_qvariant(int qt_type) const
Convert a lua value to a QVariant. The lua value will be converted to an object of requested Qt type if possible.
See also Qt/Lua types conversion section.
template <typename X> QVector<X> to_qvector() const
Create a QVector with elements from lua table. Table keys are searched from 1.
See also Qt/Lua types conversion section.
String to_string() const
Convert a lua string value to a String object. Throw exception if conversion fails.
String to_string_p(bool quote_string = true) const
Convert any type to a string representation suitable for pretty printing. Never throw.
Convert a lua value into a Ref pointer to an UserData. Throw exception if conversion fails.
See also ValueBase::to_userdata_cast_null function and ValueBase::to_userdata_cast function.
template <typename X> Ref<X> to_userdata_cast() const
Convert a lua value into a Ref pointer to an UserData and dynamic cast to given Ref pointer to requested type. Throw exception if either conversion fails, pointer is null or cast fails.
See also ValueBase::to_userdata function and ValueBase::to_userdata_cast function.
template <typename X> Ref<X> to_userdata_cast_null() const
Convert a lua value into a Ref pointer to an UserData and dynamic cast to given Ref pointer to requested type. Throw exception if conversion or cast fails.
See also ValueBase::to_userdata function and ValueBase::to_userdata_cast function.
ValueBase::ValueType type() const
Get lua value type.
String type_name() const
Get value raw lua type name.
Get value raw lua type name.
String type_name_u() const
Get value type name, if the value is a UserData, the type name is extracted using the UserData::get_type_name function.