libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Namespaces | Macros | Functions
LuaType.h File Reference
#include <Rocket/Core/Lua/Header.h>
#include <Rocket/Core/Lua/lua.hpp>
#include "LuaType.inl"

Go to the source code of this file.

Classes

struct  Rocket::Core::Lua::RegType< T >
 
class  Rocket::Core::Lua::LuaType< T >
 
struct  Rocket::Core::Lua::LuaType< T >::RegType
 

Namespaces

 Rocket
 
 Rocket::Core
 
 Rocket::Core::Lua
 

Macros

#define LUAMETHOD(type, name)   { #name, type##name },
 
#define LUAGETTER(type, varname)   { #varname, type##GetAttr##varname },
 
#define LUASETTER(type, varname)   { #varname, type##SetAttr##varname },
 
#define CHECK_BOOL(L, narg)   (lua_toboolean((L),(narg)) > 0 ? true : false )
 
#define LUACHECKOBJ(obj)   if((obj) == NULL) { lua_pushnil(L); return 1; }
 
#define LUACORETYPEDEFINE(type, is_ref_counted)
 
#define LUACONTROLSTYPEDEFINE(type, is_ref_counted)
 
#define LUACORETYPEDECLARE(type)
 
#define LUACONTROLSTYPEDECLARE(type)
 

Functions

template<typename T >
ROCKETLUA_API RegType< T > * Rocket::Core::Lua::GetMethodTable ()
 
template<typename T >
ROCKETLUA_API luaL_Reg * Rocket::Core::Lua::GetAttrTable ()
 
template<typename T >
ROCKETLUA_API luaL_Reg * Rocket::Core::Lua::SetAttrTable ()
 
template<typename T >
ROCKETLUA_API const char * Rocket::Core::Lua::GetTClassName ()
 
template<typename T >
ROCKETLUA_API bool Rocket::Core::Lua::IsReferenceCounted ()
 
template<typename T >
ROCKETLUA_API void Rocket::Core::Lua::ExtraInit (lua_State *L, int metatable_index)
 

Macro Definition Documentation

#define CHECK_BOOL (   L,
  narg 
)    (lua_toboolean((L),(narg)) > 0 ? true : false )
#define LUACHECKOBJ (   obj)    if((obj) == NULL) { lua_pushnil(L); return 1; }
#define LUACONTROLSTYPEDECLARE (   type)
Value:
template<> ROCKETLUA_API const char* GetTClassName<type>(); \
template<> ROCKETLUA_API RegType<type>* GetMethodTable<type>(); \
template<> ROCKETLUA_API luaL_Reg* GetAttrTable<type>(); \
template<> ROCKETLUA_API luaL_Reg* SetAttrTable<type>(); \
template<> ROCKETLUA_API bool IsReferenceCounted<type>(); \
#define ROCKETLUA_API
Definition: Header.h:47

Used to remove repetitive typing at the cost of flexibility. It creates function prototypes for getting the name of the type, method tables, and if it is reference counted. When you use this, you either must also use the LUACORETYPEDEFINE macro, or make sure that the function signatures are exact.

#define LUACONTROLSTYPEDEFINE (   type,
  is_ref_counted 
)
Value:
template<> const char* GetTClassName<type>() { return #type; } \
template<> RegType<type>* GetMethodTable<type>() { return Rocket::Controls::Lua::type##Methods; } \
template<> luaL_Reg* GetAttrTable<type>() { return Rocket::Controls::Lua::type##Getters; } \
template<> luaL_Reg* SetAttrTable<type>() { return Rocket::Controls::Lua::type##Setters; } \
template<> bool IsReferenceCounted<type>() { return (is_ref_counted); } \
#define LUACORETYPEDECLARE (   type)
Value:
template<> ROCKETLUA_API const char* GetTClassName<type>(); \
template<> ROCKETLUA_API RegType<type>* GetMethodTable<type>(); \
template<> ROCKETLUA_API luaL_Reg* GetAttrTable<type>(); \
template<> ROCKETLUA_API luaL_Reg* SetAttrTable<type>(); \
template<> ROCKETLUA_API bool IsReferenceCounted<type>(); \
#define ROCKETLUA_API
Definition: Header.h:47

Used to remove repetitive typing at the cost of flexibility. It creates function prototypes for getting the name of the type, method tables, and if it is reference counted. When you use this, you either must also use the LUACORETYPEDEFINE macro, or make sure that the function signatures are exact.

#define LUACORETYPEDEFINE (   type,
  is_ref_counted 
)
Value:
template<> const char* GetTClassName<type>() { return #type; } \
template<> RegType<type>* GetMethodTable<type>() { return type##Methods; } \
template<> luaL_Reg* GetAttrTable<type>() { return type##Getters; } \
template<> luaL_Reg* SetAttrTable<type>() { return type##Setters; } \
template<> bool IsReferenceCounted<type>() { return (is_ref_counted); } \

Used to remove repetitive typing at the cost of flexibility. When you use this, you must have functions with the same name as defined in the macro. For example, if you used Element as type, you would have to have functions named ElementMethods, ElementGetters, ElementSetters that return the appropriate types.

Parameters
is_reference_countedtrue if the type inherits from Rocket::Core::ReferenceCountable, false otherwise
#define LUAGETTER (   type,
  varname 
)    { #varname, type##GetAttr##varname },
#define LUAMETHOD (   type,
  name 
)    { #name, type##name },
#define LUASETTER (   type,
  varname 
)    { #varname, type##SetAttr##varname },