Luwra
Minimal-overhead Lua wrapper for C++
|
Classes | |
struct | luwra::internal::UserTypeWrapper< UserType >::ConstructorWrapper< Args > |
struct | luwra::internal::UserTypeReg< UserType > |
struct | luwra::internal::UserTypeWrapper< UserType > |
struct | luwra::Value< UserType > |
Enables reading/pushing for an arbitrary type. More... | |
struct | luwra::Value< UserType * > |
Enables reading and pushing the arbitrary type UserType . More... | |
Namespaces | |
namespace | luwra |
namespace | luwra::internal |
Macros | |
#define | LUWRA_DEF_REGISTRY_NAME(type, regname) |
Define the registry name for a user type. This macro has to be used outside of any namespace. | |
#define | LUWRA_MEMBER(type, name) {#name, LUWRA_WRAP_MEMBER(type, name)} |
Generate a user type member manifest. This is basically any type which can be constructed using a string and a lua_CFunction . For example std::pair<Pushable, Pushable> . | |
#define | LUWRA_WRAP_CONSTRUCTOR(type, ...) (&luwra::internal::UserTypeWrapper<type>::ConstructorWrapper<__VA_ARGS__>::invoke) |
Generate a lua_CFunction wrapper for a constructor. | |
Typedefs | |
template<typename UserType > | |
using | luwra::internal::StripUserType = typename std::remove_cv< UserType >::type |
Functions | |
template<typename UserType , typename... Args> | |
UserType & | luwra::construct (State *state, Args &&... args) |
Construct a user type value on the stack. | |
template<typename Sig > | |
void | luwra::registerUserType (State *state, const char *ctor_name, const MemberMap &props=MemberMap(), const MemberMap &meta=MemberMap()) |
Same as the other registerUserType but registers a constructor in the global namespace. | |
template<typename UserType > | |
void | luwra::registerUserType (State *state, const MemberMap &props=MemberMap(), const MemberMap &meta=MemberMap()) |
Register the metatable for a user type. This function allows you to register properties which are shared across all instances of the user type. | |
#define LUWRA_DEF_REGISTRY_NAME | ( | type, | |
regname | |||
) |
Define the registry name for a user type. This macro has to be used outside of any namespace.
type | User type |
regname | Registry name |
#define LUWRA_MEMBER | ( | type, | |
name | |||
) | {#name, LUWRA_WRAP_MEMBER(type, name)} |
Generate a user type member manifest. This is basically any type which can be constructed using a string and a lua_CFunction
. For example std::pair<Pushable, Pushable>
.
type | User type |
name | Member name |
Example:
#define LUWRA_WRAP_CONSTRUCTOR | ( | type, | |
... | |||
) | (&luwra::internal::UserTypeWrapper<type>::ConstructorWrapper<__VA_ARGS__>::invoke) |
Generate a lua_CFunction
wrapper for a constructor.
type | Type to instantiate |
... | Constructor parameter types |
Example:
in Lua