Lua-API++
2015-02-12-3
Lua-API++ library
|
Every thing in Lua API++ library is contained inside this namespace. More...
Classes | |
struct | ClosureInfo |
Closure properties. [Lua 5.2+ only] More... | |
class | Context |
Access point to Lua context. More... | |
class | Nil |
Type of nil value. More... | |
class | RegistryKey |
Key for registry-stored values. More... | |
class | Retval |
Return value for Lua functions. More... | |
class | State |
Lua state object. More... | |
class | Table |
Table object with specialized interface. Similar to Value, it owns a stack slot. More... | |
class | Temporary |
Temporary Lua value. More... | |
struct | TypeID |
Determine Lua type ID from native type. More... | |
class | Valobj |
Lua-compatible value. More... | |
class | Valref |
Non-owning reference to Lua value. More... | |
class | Valset |
Valset is an STL-compatible container for contiguous Lua stack slots. Its primary use is accepting multiple return values. More... | |
class | Value |
Owner of a single stack slot. More... | |
Typedefs | |
using | LFunction = Retval(*)(Context &) |
Pointer to Lua API++ compatible function. More... | |
using | CFunction = int(*)(lua_State *) |
C function callable by Lua (plain Lua API format). More... | |
typedef void * | LightUserData |
Light userdata. More... | |
Enumerations | |
enum | ValueType { None = -1, Nil, Boolean, LightUserdata, Number, String, Table, Function, C_Function, UserData, Thread, Any } |
Types of Lua values. More... | |
Functions | |
template<LFunction F> | |
int | mkcf (lua_State *l) |
Wrapper for LFunction that creates a proper Lua-compatible C function. More... | |
Variables | |
static constexpr Nil | nil {} |
Constant representing nil value. More... | |
Every thing in Lua API++ library is contained inside this namespace.
struct lua::ClosureInfo |
Closure properties. [Lua 5.2+ only]
Class Members | ||
---|---|---|
size_t | nUpvalues | Amount of upvalues. |
size_t | nParameters | Amount of parameters. |
bool | variadic | Whether function accepts variable number of arguments. |
class lua::Temporary |
class lua::Valobj |
Lua-compatible value.
This is not an actual type, it designates any type of value that is or can become a Lua value: references to Lua stack, temporaries, native numbers and strings, userdata etc.
using CFunction = int (*)(lua_State*) |
C function callable by Lua (plain Lua API format).
typedef void* LightUserData |
Light userdata.
This typedef is provided for explicit designation of light userdata.
|
strong |
Types of Lua values.
This enum is used to identify actual types of Lua values both in compile-time and runtime.
int lua::mkcf | ( | lua_State * | l | ) |
Wrapper for LFunction that creates a proper Lua-compatible C function.
template<LFunction F> mkcf
This template converts Lua API++ compatible function to a proper Lua-compatible C function (mkcf is short for "make C function"). The wrapper creates Context object and passes it to wrapped function, then converts returned Retval to number of returned values. All exceptions that come from wrapped function are intercepted and converted to Lua runtime errors. Example:
Note the lack of round parentheses when using mkcf template.