cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LuaBasicConversions.h File Reference
#include "lua.h"
#include "tolua++.h"
#include "tolua_fix.h"
#include "cocos2d.h"

Macros

#define LUA_PRECONDITION(condition,...)
 

Functions

bool luaval_is_usertype (lua_State *L, int lo, const char *type, int def)
 
bool luaval_to_ulong (lua_State *L, int lo, unsigned long *outValue, const char *funcName="")
 
bool luaval_to_ushort (lua_State *L, int lo, unsigned short *outValue, const char *funcName="")
 
bool luaval_to_int32 (lua_State *L, int lo, int *outValue, const char *funcName="")
 
bool luaval_to_uint32 (lua_State *L, int lo, unsigned int *outValue, const char *funcName="")
 
bool luaval_to_uint16 (lua_State *L, int lo, uint16_t *outValue, const char *funcName="")
 
bool luaval_to_boolean (lua_State *L, int lo, bool *outValue, const char *funcName="")
 
bool luaval_to_number (lua_State *L, int lo, double *outValue, const char *funcName="")
 
bool luaval_to_long_long (lua_State *L, int lo, long long *outValue, const char *funcName="")
 
bool luaval_to_std_string (lua_State *L, int lo, std::string *outValue, const char *funcName="")
 
bool luaval_to_long (lua_State *L, int lo, long *outValue, const char *funcName="")
 
bool luaval_to_ssize (lua_State *L, int lo, ssize_t *outValue, const char *funcName="")
 
bool luaval_to_size (lua_State *L, int lo, Size *outValue, const char *funcName="")
 
bool luaval_to_rect (lua_State *L, int lo, Rect *outValue, const char *funcName="")
 
bool luaval_to_color3b (lua_State *L, int lo, Color3B *outValue, const char *funcName="")
 
bool luaval_to_color4b (lua_State *L, int lo, Color4B *outValue, const char *funcName="")
 
bool luaval_to_color4f (lua_State *L, int lo, Color4F *outValue, const char *funcName="")
 
bool luaval_to_physics_material (lua_State *L, int lo, cocos2d::PhysicsMaterial *outValue, const char *funcName="")
 
bool luaval_to_affinetransform (lua_State *L, int lo, AffineTransform *outValue, const char *funcName="")
 
bool luaval_to_fontdefinition (lua_State *L, int lo, FontDefinition *outValue, const char *funcName="")
 
bool luaval_to_mat4 (lua_State *L, int lo, cocos2d::Mat4 *outValue, const char *funcName="")
 
bool luaval_to_array (lua_State *L, int lo, __Array **outValue, const char *funcName="")
 
bool luaval_to_dictionary (lua_State *L, int lo, __Dictionary **outValue, const char *funcName="")
 
bool luaval_to_array_of_vec2 (lua_State *L, int lo, cocos2d::Vec2 **points, int *numPoints, const char *funcName="")
 
bool luavals_variadic_to_array (lua_State *L, int argc, __Array **ret)
 
bool luavals_variadic_to_ccvaluevector (lua_State *L, int argc, cocos2d::ValueVector *ret)
 
bool luaval_to_vec2 (lua_State *L, int lo, cocos2d::Vec2 *outValue, const char *funcName="")
 
bool luaval_to_vec3 (lua_State *L, int lo, cocos2d::Vec3 *outValue, const char *funcName="")
 
bool luaval_to_vec4 (lua_State *L, int lo, cocos2d::Vec4 *outValue, const char *funcName="")
 
bool luaval_to_blendfunc (lua_State *L, int lo, cocos2d::BlendFunc *outValue, const char *funcName="")
 
bool luaval_to_ttfconfig (lua_State *L, int lo, cocos2d::TTFConfig *outValue, const char *funcName="")
 
bool luaval_to_uniform (lua_State *L, int lo, cocos2d::Uniform *outValue, const char *funcName="")
 
bool luaval_to_vertexattrib (lua_State *L, int lo, cocos2d::VertexAttrib *outValue, const char *funcName="")
 
template<class T >
bool luavals_variadic_to_ccvector (lua_State *L, int argc, cocos2d::Vector< T > *ret)
 
template<class T >
bool luaval_to_ccvector (lua_State *L, int lo, cocos2d::Vector< T > *ret, const char *funcName="")
 
bool luaval_to_std_vector_string (lua_State *L, int lo, std::vector< std::string > *ret, const char *funcName="")
 
bool luaval_to_std_vector_int (lua_State *L, int lo, std::vector< int > *ret, const char *funcName="")
 
template<class T >
bool luaval_to_ccmap_string_key (lua_State *L, int lo, cocos2d::Map< std::string, T > *ret, const char *funcName="")
 
bool luaval_to_ccvalue (lua_State *L, int lo, cocos2d::Value *ret, const char *funcName="")
 
bool luaval_to_ccvaluemap (lua_State *L, int lo, cocos2d::ValueMap *ret, const char *funcName="")
 
bool luaval_to_ccvaluemapintkey (lua_State *L, int lo, cocos2d::ValueMapIntKey *ret, const char *funcName="")
 
bool luaval_to_ccvaluevector (lua_State *L, int lo, cocos2d::ValueVector *ret, const char *funcName="")
 
template<class T >
bool luaval_to_object (lua_State *L, int lo, const char *type, T **ret)
 
bool luaval_to_mesh_vertex_attrib (lua_State *L, int lo, cocos2d::MeshVertexAttrib *ret, const char *funcName="")
 
bool luaval_to_std_vector_float (lua_State *L, int lo, std::vector< float > *ret, const char *funcName="")
 
bool luaval_to_std_vector_ushort (lua_State *L, int lo, std::vector< unsigned short > *ret, const char *funcName="")
 
bool luaval_to_quaternion (lua_State *L, int lo, cocos2d::Quaternion *outValue, const char *funcName="")
 
void vec2_to_luaval (lua_State *L, const cocos2d::Vec2 &vec2)
 
void vec3_to_luaval (lua_State *L, const cocos2d::Vec3 &vec3)
 
void vec4_to_luaval (lua_State *L, const cocos2d::Vec4 &vec4)
 
void vec2_array_to_luaval (lua_State *L, const cocos2d::Vec2 *points, int count)
 
void size_to_luaval (lua_State *L, const Size &sz)
 
void rect_to_luaval (lua_State *L, const Rect &rt)
 
void color3b_to_luaval (lua_State *L, const Color3B &cc)
 
void color4b_to_luaval (lua_State *L, const Color4B &cc)
 
void color4f_to_luaval (lua_State *L, const Color4F &cc)
 
void physics_material_to_luaval (lua_State *L, const PhysicsMaterial &pm)
 
void physics_raycastinfo_to_luaval (lua_State *L, const PhysicsRayCastInfo &info)
 
void physics_contactdata_to_luaval (lua_State *L, const PhysicsContactData *data)
 
void affinetransform_to_luaval (lua_State *L, const AffineTransform &inValue)
 
void fontdefinition_to_luaval (lua_State *L, const FontDefinition &inValue)
 
void array_to_luaval (lua_State *L, __Array *inValue)
 
void dictionary_to_luaval (lua_State *L, __Dictionary *dict)
 
void mat4_to_luaval (lua_State *L, const cocos2d::Mat4 &mat)
 
void blendfunc_to_luaval (lua_State *L, const cocos2d::BlendFunc &func)
 
void ttfconfig_to_luaval (lua_State *L, const cocos2d::TTFConfig &config)
 
void uniform_to_luaval (lua_State *L, const cocos2d::Uniform &uniform)
 
void vertexattrib_to_luaval (lua_State *L, const cocos2d::VertexAttrib &verAttrib)
 
template<class T >
void ccvector_to_luaval (lua_State *L, const cocos2d::Vector< T > &inValue)
 
template<class T >
void ccmap_string_key_to_luaval (lua_State *L, const cocos2d::Map< std::string, T > &v)
 
void ccvalue_to_luaval (lua_State *L, const cocos2d::Value &inValue)
 
void ccvaluemap_to_luaval (lua_State *L, const cocos2d::ValueMap &inValue)
 
void ccvaluemapintkey_to_luaval (lua_State *L, const cocos2d::ValueMapIntKey &inValue)
 
void ccvaluevector_to_luaval (lua_State *L, const cocos2d::ValueVector &inValue)
 
template<class T >
const char * getLuaTypeName (T *ret, const char *type)
 Because all override functions wouldn't be bound,so we must use typeid to get the real class name. More...
 
template<class T >
void object_to_luaval (lua_State *L, const char *type, T *ret)
 
void mesh_vertex_attrib_to_luaval (lua_State *L, const cocos2d::MeshVertexAttrib &inValue)
 
void ccvector_std_string_to_luaval (lua_State *L, const std::vector< std::string > &inValue)
 
void ccvector_int_to_luaval (lua_State *L, const std::vector< int > &inValue)
 
void ccvector_float_to_luaval (lua_State *L, const std::vector< float > &inValue)
 
void ccvector_ushort_to_luaval (lua_State *L, const std::vector< unsigned short > &inValue)
 
void quaternion_to_luaval (lua_State *L, const cocos2d::Quaternion &inValue)
 

Variables

std::unordered_map
< std::string, std::string > 
g_luaType
 
std::unordered_map
< std::string, std::string > 
g_typeCast
 

Macro Definition Documentation

#define LUA_PRECONDITION (   condition,
  ... 
)
Value:
if( ! (condition) ) { \
cocos2d::log("lua: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
} \
void CC_DLL log(const char *format,...) CC_FORMAT_PRINTF(1
Output Debug message.

Function Documentation

void affinetransform_to_luaval ( lua_State *  L,
const AffineTransform inValue 
)
void array_to_luaval ( lua_State *  L,
__Array inValue 
)
void blendfunc_to_luaval ( lua_State *  L,
const cocos2d::BlendFunc func 
)
void ccmap_string_key_to_luaval ( lua_State *  L,
const cocos2d::Map< std::string, T > &  v 
)
void ccvalue_to_luaval ( lua_State *  L,
const cocos2d::Value inValue 
)
void ccvaluemap_to_luaval ( lua_State *  L,
const cocos2d::ValueMap inValue 
)
void ccvaluemapintkey_to_luaval ( lua_State *  L,
const cocos2d::ValueMapIntKey inValue 
)
void ccvaluevector_to_luaval ( lua_State *  L,
const cocos2d::ValueVector inValue 
)
void ccvector_float_to_luaval ( lua_State *  L,
const std::vector< float > &  inValue 
)
void ccvector_int_to_luaval ( lua_State *  L,
const std::vector< int > &  inValue 
)
void ccvector_std_string_to_luaval ( lua_State *  L,
const std::vector< std::string > &  inValue 
)
void ccvector_to_luaval ( lua_State *  L,
const cocos2d::Vector< T > &  inValue 
)
void ccvector_ushort_to_luaval ( lua_State *  L,
const std::vector< unsigned short > &  inValue 
)
void color3b_to_luaval ( lua_State *  L,
const Color3B cc 
)
void color4b_to_luaval ( lua_State *  L,
const Color4B cc 
)
void color4f_to_luaval ( lua_State *  L,
const Color4F cc 
)
void dictionary_to_luaval ( lua_State *  L,
__Dictionary dict 
)
void fontdefinition_to_luaval ( lua_State *  L,
const FontDefinition inValue 
)
const char* getLuaTypeName ( T *  ret,
const char *  type 
)

Because all override functions wouldn't be bound,so we must use typeid to get the real class name.

bool luaval_is_usertype ( lua_State *  L,
int  lo,
const char *  type,
int  def 
)
bool luaval_to_affinetransform ( lua_State *  L,
int  lo,
AffineTransform outValue,
const char *  funcName = "" 
)
bool luaval_to_array ( lua_State *  L,
int  lo,
__Array **  outValue,
const char *  funcName = "" 
)
bool luaval_to_array_of_vec2 ( lua_State *  L,
int  lo,
cocos2d::Vec2 **  points,
int *  numPoints,
const char *  funcName = "" 
)
bool luaval_to_blendfunc ( lua_State *  L,
int  lo,
cocos2d::BlendFunc outValue,
const char *  funcName = "" 
)
bool luaval_to_boolean ( lua_State *  L,
int  lo,
bool *  outValue,
const char *  funcName = "" 
)
bool luaval_to_ccmap_string_key ( lua_State *  L,
int  lo,
cocos2d::Map< std::string, T > *  ret,
const char *  funcName = "" 
)
bool luaval_to_ccvalue ( lua_State *  L,
int  lo,
cocos2d::Value ret,
const char *  funcName = "" 
)
bool luaval_to_ccvaluemap ( lua_State *  L,
int  lo,
cocos2d::ValueMap ret,
const char *  funcName = "" 
)
bool luaval_to_ccvaluemapintkey ( lua_State *  L,
int  lo,
cocos2d::ValueMapIntKey ret,
const char *  funcName = "" 
)
bool luaval_to_ccvaluevector ( lua_State *  L,
int  lo,
cocos2d::ValueVector ret,
const char *  funcName = "" 
)
bool luaval_to_ccvector ( lua_State *  L,
int  lo,
cocos2d::Vector< T > *  ret,
const char *  funcName = "" 
)
bool luaval_to_color3b ( lua_State *  L,
int  lo,
Color3B outValue,
const char *  funcName = "" 
)
bool luaval_to_color4b ( lua_State *  L,
int  lo,
Color4B outValue,
const char *  funcName = "" 
)
bool luaval_to_color4f ( lua_State *  L,
int  lo,
Color4F outValue,
const char *  funcName = "" 
)
bool luaval_to_dictionary ( lua_State *  L,
int  lo,
__Dictionary **  outValue,
const char *  funcName = "" 
)
bool luaval_to_fontdefinition ( lua_State *  L,
int  lo,
FontDefinition outValue,
const char *  funcName = "" 
)
bool luaval_to_int32 ( lua_State *  L,
int  lo,
int *  outValue,
const char *  funcName = "" 
)
bool luaval_to_long ( lua_State *  L,
int  lo,
long *  outValue,
const char *  funcName = "" 
)
bool luaval_to_long_long ( lua_State *  L,
int  lo,
long long *  outValue,
const char *  funcName = "" 
)
bool luaval_to_mat4 ( lua_State *  L,
int  lo,
cocos2d::Mat4 *  outValue,
const char *  funcName = "" 
)
bool luaval_to_mesh_vertex_attrib ( lua_State *  L,
int  lo,
cocos2d::MeshVertexAttrib ret,
const char *  funcName = "" 
)
bool luaval_to_number ( lua_State *  L,
int  lo,
double *  outValue,
const char *  funcName = "" 
)
bool luaval_to_object ( lua_State *  L,
int  lo,
const char *  type,
T **  ret 
)
bool luaval_to_physics_material ( lua_State *  L,
int  lo,
cocos2d::PhysicsMaterial *  outValue,
const char *  funcName = "" 
)
bool luaval_to_quaternion ( lua_State *  L,
int  lo,
cocos2d::Quaternion *  outValue,
const char *  funcName = "" 
)
bool luaval_to_rect ( lua_State *  L,
int  lo,
Rect outValue,
const char *  funcName = "" 
)
bool luaval_to_size ( lua_State *  L,
int  lo,
Size outValue,
const char *  funcName = "" 
)
bool luaval_to_ssize ( lua_State *  L,
int  lo,
ssize_t outValue,
const char *  funcName = "" 
)
bool luaval_to_std_string ( lua_State *  L,
int  lo,
std::string *  outValue,
const char *  funcName = "" 
)
bool luaval_to_std_vector_float ( lua_State *  L,
int  lo,
std::vector< float > *  ret,
const char *  funcName = "" 
)
bool luaval_to_std_vector_int ( lua_State *  L,
int  lo,
std::vector< int > *  ret,
const char *  funcName = "" 
)
bool luaval_to_std_vector_string ( lua_State *  L,
int  lo,
std::vector< std::string > *  ret,
const char *  funcName = "" 
)
bool luaval_to_std_vector_ushort ( lua_State *  L,
int  lo,
std::vector< unsigned short > *  ret,
const char *  funcName = "" 
)
bool luaval_to_ttfconfig ( lua_State *  L,
int  lo,
cocos2d::TTFConfig *  outValue,
const char *  funcName = "" 
)
bool luaval_to_uint16 ( lua_State *  L,
int  lo,
uint16_t outValue,
const char *  funcName = "" 
)
bool luaval_to_uint32 ( lua_State *  L,
int  lo,
unsigned int *  outValue,
const char *  funcName = "" 
)
bool luaval_to_ulong ( lua_State *  L,
int  lo,
unsigned long *  outValue,
const char *  funcName = "" 
)
bool luaval_to_uniform ( lua_State *  L,
int  lo,
cocos2d::Uniform outValue,
const char *  funcName = "" 
)
bool luaval_to_ushort ( lua_State *  L,
int  lo,
unsigned short *  outValue,
const char *  funcName = "" 
)
bool luaval_to_vec2 ( lua_State *  L,
int  lo,
cocos2d::Vec2 *  outValue,
const char *  funcName = "" 
)
bool luaval_to_vec3 ( lua_State *  L,
int  lo,
cocos2d::Vec3 *  outValue,
const char *  funcName = "" 
)
bool luaval_to_vec4 ( lua_State *  L,
int  lo,
cocos2d::Vec4 *  outValue,
const char *  funcName = "" 
)
bool luaval_to_vertexattrib ( lua_State *  L,
int  lo,
cocos2d::VertexAttrib outValue,
const char *  funcName = "" 
)
bool luavals_variadic_to_array ( lua_State *  L,
int  argc,
__Array **  ret 
)
bool luavals_variadic_to_ccvaluevector ( lua_State *  L,
int  argc,
cocos2d::ValueVector ret 
)
bool luavals_variadic_to_ccvector ( lua_State *  L,
int  argc,
cocos2d::Vector< T > *  ret 
)
void mat4_to_luaval ( lua_State *  L,
const cocos2d::Mat4 &  mat 
)
void mesh_vertex_attrib_to_luaval ( lua_State *  L,
const cocos2d::MeshVertexAttrib inValue 
)
void object_to_luaval ( lua_State *  L,
const char *  type,
T *  ret 
)
void physics_contactdata_to_luaval ( lua_State *  L,
const PhysicsContactData data 
)
void physics_material_to_luaval ( lua_State *  L,
const PhysicsMaterial pm 
)
void physics_raycastinfo_to_luaval ( lua_State *  L,
const PhysicsRayCastInfo info 
)
void quaternion_to_luaval ( lua_State *  L,
const cocos2d::Quaternion &  inValue 
)
void rect_to_luaval ( lua_State *  L,
const Rect rt 
)
void size_to_luaval ( lua_State *  L,
const Size sz 
)
void ttfconfig_to_luaval ( lua_State *  L,
const cocos2d::TTFConfig &  config 
)
void uniform_to_luaval ( lua_State *  L,
const cocos2d::Uniform uniform 
)
void vec2_array_to_luaval ( lua_State *  L,
const cocos2d::Vec2 *  points,
int  count 
)
void vec2_to_luaval ( lua_State *  L,
const cocos2d::Vec2 &  vec2 
)
void vec3_to_luaval ( lua_State *  L,
const cocos2d::Vec3 &  vec3 
)
void vec4_to_luaval ( lua_State *  L,
const cocos2d::Vec4 &  vec4 
)
void vertexattrib_to_luaval ( lua_State *  L,
const cocos2d::VertexAttrib verAttrib 
)

Variable Documentation

std::unordered_map<std::string, std::string> g_luaType
std::unordered_map<std::string, std::string> g_typeCast