cocos2d-x  3.1rc0
 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  (lua_State *L, int lo, const char *type, int def)
bool  (lua_State *L, int lo, unsigned short *outValue)
bool  (lua_State *L, int lo, int *outValue)
bool  (lua_State *L, int lo, unsigned int *outValue)
bool  (lua_State *L, int lo, uint16_t *outValue)
bool  (lua_State *L, int lo, bool *outValue)
bool  (lua_State *L, int lo, double *outValue)
bool  (lua_State *L, int lo, long long *outValue)
bool  (lua_State *L, int lo, std::string *outValue)
bool  (lua_State *L, int lo, long *outValue)
bool  (lua_State *L, int lo, ssize_t *outValue)
bool  (lua_State *L, int lo, Size *outValue)
bool  (lua_State *L, int lo, Rect *outValue)
bool  (lua_State *L, int lo, Color3B *outValue)
bool  (lua_State *L, int lo, Color4B *outValue)
bool  (lua_State *L, int lo, Color4F *outValue)
bool  (lua_State *L, int lo, cocos2d::PhysicsMaterial *outValue)
bool  (lua_State *L, int lo, AffineTransform *outValue)
bool  (lua_State *L, int lo, FontDefinition *outValue)
bool  (lua_State *L, int lo, cocos2d::Mat4 *outValue)
bool  (lua_State *L, int lo, __Array **outValue)
bool  (lua_State *L, int lo, __Dictionary **outValue)
bool  (lua_State *L, int lo, cocos2d::Vec2 **points, int *numPoints)
bool  (lua_State *L, int argc, __Array **ret)
bool  (lua_State *L, int argc, cocos2d::ValueVector *ret)
var  ( var L, var argc, var ret)
local  ( local L, local argc, local ret)
bool  (lua_State *L, int lo, cocos2d::Vec2 *outValue)
bool  (lua_State *L, int lo, cocos2d::Vec3 *outValue)
bool  (lua_State *L, int lo, cocos2d::BlendFunc *outValue)
bool  (lua_State *L, int lo, cocos2d::TTFConfig *outValue)
template<class T >
bool  (lua_State *L, int argc, cocos2d::Vector< T > *ret)
template<class T >
bool  (lua_State *L, int lo, cocos2d::Vector< T > *ret)
bool  (lua_State *L, int lo, std::vector< std::string > *ret)
bool  (lua_State *L, int lo, std::vector< int > *ret)
template<class T >
bool  (lua_State *L, int lo, cocos2d::Map< std::string, T > *ret)
bool  (lua_State *L, int lo, cocos2d::Value *ret)
bool  (lua_State *L, int lo, cocos2d::ValueMap *ret)
bool  (lua_State *L, int lo, cocos2d::ValueMapIntKey *ret)
bool  (lua_State *L, int lo, cocos2d::ValueVector *ret)
template<class T >
bool  (lua_State *L, int lo, const char *type, T **ret)
template<class T >
var  ( var L, var lo, var type, var ret)
template<class T >
local  ( local L, local lo, local type, local ret)
void  (lua_State *L, const cocos2d::Vec2 &vec2)
void  (lua_State *L, const cocos2d::Vec3 &vec3)
void  (lua_State *L, const cocos2d::Vec2 *points, int count)
void  (lua_State *L, const Size &sz)
void  (lua_State *L, const Rect &rt)
void  (lua_State *L, const Color3B &cc)
void  (lua_State *L, const Color4B &cc)
void  (lua_State *L, const Color4F &cc)
void  (lua_State *L, const PhysicsMaterial &pm)
void  (lua_State *L, const PhysicsRayCastInfo &info)
void  (lua_State *L, const PhysicsContactData *data)
void  (lua_State *L, const AffineTransform &inValue)
void  (lua_State *L, const FontDefinition &inValue)
void  (lua_State *L, __Array *inValue)
void  (lua_State *L, __Dictionary *dict)
void  (lua_State *L, const cocos2d::Mat4 &mat)
void  (lua_State *L, const cocos2d::BlendFunc &func)
void  (lua_State *L, const cocos2d::TTFConfig &config)
template<class T >
void  (lua_State *L, const cocos2d::Vector< T > &inValue)
template<class T >
void  (lua_State *L, const cocos2d::Map< std::string, T > &v)
void  (lua_State *L, const cocos2d::Value &inValue)
void  (lua_State *L, const cocos2d::ValueMap &inValue)
void  (lua_State *L, const cocos2d::ValueMapIntKey &inValue)
void  (lua_State *L, const cocos2d::ValueVector &inValue)
template<class T >
const char *  (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  (lua_State *L, const char *type, T *ret)

Variables

std::unordered_map
< std::string, std::string > 
g_luaType
std::unordered_map
< std::string, std::string > 
g_typeCast
var g_typeCast
local 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__); \
} \
var LUA_PRECONDITION (   var,
  ... 
)
Value:
if( ! (condition) ) { \
cocos2d::log("lua: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
} \
local LUA_PRECONDITION (   local,
  ... 
)
Value:
if( ! (condition) ) { \
cocos2d::log("lua: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
} \

Function Documentation

bool luaval_is_usertype ( lua_State *  L,
int  lo,
const char *  type,
int  def 
)
var luaval_is_usertype ( var  L,
var  lo,
var  type,
var  def 
)
local luaval_is_usertype ( local  L,
local  lo,
local  type,
local  def 
)
bool luaval_to_ushort ( lua_State *  L,
int  lo,
unsigned short *  outValue 
)
var luaval_to_ushort ( var  L,
var  lo,
var  outValue 
)
local luaval_to_ushort ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_int32 ( lua_State *  L,
int  lo,
int *  outValue 
)
var luaval_to_int32 ( var  L,
var  lo,
var  outValue 
)
local luaval_to_int32 ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_uint32 ( lua_State *  L,
int  lo,
unsigned int *  outValue 
)
var luaval_to_uint32 ( var  L,
var  lo,
var  outValue 
)
local luaval_to_uint32 ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_uint16 ( lua_State *  L,
int  lo,
uint16_t outValue 
)
var luaval_to_uint16 ( var  L,
var  lo,
var  outValue 
)
local luaval_to_uint16 ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_boolean ( lua_State *  L,
int  lo,
bool *  outValue 
)
var luaval_to_boolean ( var  L,
var  lo,
var  outValue 
)
local luaval_to_boolean ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_number ( lua_State *  L,
int  lo,
double *  outValue 
)
var luaval_to_number ( var  L,
var  lo,
var  outValue 
)
local luaval_to_number ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_long_long ( lua_State *  L,
int  lo,
long long *  outValue 
)
var luaval_to_long_long ( var  L,
var  lo,
var  outValue 
)
local luaval_to_long_long ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_std_string ( lua_State *  L,
int  lo,
std::string *  outValue 
)
var luaval_to_std_string ( var  L,
var  lo,
var  outValue 
)
local luaval_to_std_string ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_long ( lua_State *  L,
int  lo,
long *  outValue 
)
var luaval_to_long ( var  L,
var  lo,
var  outValue 
)
local luaval_to_long ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_ssize ( lua_State *  L,
int  lo,
ssize_t outValue 
)
var luaval_to_ssize ( var  L,
var  lo,
var  outValue 
)
local luaval_to_ssize ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_size ( lua_State *  L,
int  lo,
Size outValue 
)
var luaval_to_size ( var  L,
var  lo,
var  outValue 
)
local luaval_to_size ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_rect ( lua_State *  L,
int  lo,
Rect outValue 
)
var luaval_to_rect ( var  L,
var  lo,
var  outValue 
)
local luaval_to_rect ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_color3b ( lua_State *  L,
int  lo,
Color3B outValue 
)
var luaval_to_color3b ( var  L,
var  lo,
var  outValue 
)
local luaval_to_color3b ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_color4b ( lua_State *  L,
int  lo,
Color4B outValue 
)
var luaval_to_color4b ( var  L,
var  lo,
var  outValue 
)
local luaval_to_color4b ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_color4f ( lua_State *  L,
int  lo,
Color4F outValue 
)
var luaval_to_color4f ( var  L,
var  lo,
var  outValue 
)
local luaval_to_color4f ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_physics_material ( lua_State *  L,
int  lo,
cocos2d::PhysicsMaterial *  outValue 
)
var luaval_to_physics_material ( var  L,
var  lo,
var  outValue 
)
local luaval_to_physics_material ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_affinetransform ( lua_State *  L,
int  lo,
AffineTransform outValue 
)
var luaval_to_affinetransform ( var  L,
var  lo,
var  outValue 
)
local luaval_to_affinetransform ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_fontdefinition ( lua_State *  L,
int  lo,
FontDefinition outValue 
)
var luaval_to_fontdefinition ( var  L,
var  lo,
var  outValue 
)
local luaval_to_fontdefinition ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_mat4 ( lua_State *  L,
int  lo,
cocos2d::Mat4 *  outValue 
)
var luaval_to_mat4 ( var  L,
var  lo,
var  outValue 
)
local luaval_to_mat4 ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_array ( lua_State *  L,
int  lo,
__Array **  outValue 
)
var luaval_to_array ( var  L,
var  lo,
var  outValue 
)
local luaval_to_array ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_dictionary ( lua_State *  L,
int  lo,
__Dictionary **  outValue 
)
var luaval_to_dictionary ( var  L,
var  lo,
var  outValue 
)
local luaval_to_dictionary ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_array_of_vec2 ( lua_State *  L,
int  lo,
cocos2d::Vec2 **  points,
int *  numPoints 
)
var luaval_to_array_of_vec2 ( var  L,
var  lo,
var  points,
var  numPoints 
)
local luaval_to_array_of_vec2 ( local  L,
local  lo,
local  points,
local  numPoints 
)
bool luavals_variadic_to_array ( lua_State *  L,
int  argc,
__Array **  ret 
)
var luavals_variadic_to_array ( var  L,
var  argc,
var  ret 
)
local luavals_variadic_to_array ( local  L,
local  argc,
local  ret 
)
bool
luavals_variadic_to_ccvaluevector
( lua_State *  L,
int  argc,
cocos2d::ValueVector ret 
)
var
luavals_variadic_to_ccvaluevector
( var  L,
var  argc,
var  ret 
)
local
luavals_variadic_to_ccvaluevector
( local  L,
local  argc,
local  ret 
)
bool luaval_to_vec2 ( lua_State *  L,
int  lo,
cocos2d::Vec2 *  outValue 
)
var luaval_to_vec2 ( var  L,
var  lo,
var  outValue 
)
local luaval_to_vec2 ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_vec3 ( lua_State *  L,
int  lo,
cocos2d::Vec3 *  outValue 
)
var luaval_to_vec3 ( var  L,
var  lo,
var  outValue 
)
local luaval_to_vec3 ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_blendfunc ( lua_State *  L,
int  lo,
cocos2d::BlendFunc outValue 
)
var luaval_to_blendfunc ( var  L,
var  lo,
var  outValue 
)
local luaval_to_blendfunc ( local  L,
local  lo,
local  outValue 
)
bool luaval_to_ttfconfig ( lua_State *  L,
int  lo,
cocos2d::TTFConfig *  outValue 
)
var luaval_to_ttfconfig ( var  L,
var  lo,
var  outValue 
)
local luaval_to_ttfconfig ( local  L,
local  lo,
local  outValue 
)
bool luavals_variadic_to_ccvector ( lua_State *  L,
int  argc,
cocos2d::Vector< T > *  ret 
)
var luavals_variadic_to_ccvector ( var  L,
var  argc,
var  ret 
)
local luavals_variadic_to_ccvector ( local  L,
local  argc,
local  ret 
)
bool luaval_to_ccvector ( lua_State *  L,
int  lo,
cocos2d::Vector< T > *  ret 
)
var luaval_to_ccvector ( var  L,
var  lo,
var  ret 
)
local luaval_to_ccvector ( local  L,
local  lo,
local  ret 
)
bool luaval_to_std_vector_string ( lua_State *  L,
int  lo,
std::vector< std::string > *  ret 
)
var luaval_to_std_vector_string ( var  L,
var  lo,
var  ret 
)
local luaval_to_std_vector_string ( local  L,
local  lo,
local  ret 
)
bool luaval_to_std_vector_int ( lua_State *  L,
int  lo,
std::vector< int > *  ret 
)
var luaval_to_std_vector_int ( var  L,
var  lo,
var  ret 
)
local luaval_to_std_vector_int ( local  L,
local  lo,
local  ret 
)
bool luaval_to_ccmap_string_key ( lua_State *  L,
int  lo,
cocos2d::Map< std::string, T > *  ret 
)
var luaval_to_ccmap_string_key ( var  L,
var  lo,
var  ret 
)
local luaval_to_ccmap_string_key ( local  L,
local  lo,
local  ret 
)
bool luaval_to_ccvalue ( lua_State *  L,
int  lo,
cocos2d::Value ret 
)
var luaval_to_ccvalue ( var  L,
var  lo,
var  ret 
)
local luaval_to_ccvalue ( local  L,
local  lo,
local  ret 
)
bool luaval_to_ccvaluemap ( lua_State *  L,
int  lo,
cocos2d::ValueMap ret 
)
var luaval_to_ccvaluemap ( var  L,
var  lo,
var  ret 
)
local luaval_to_ccvaluemap ( local  L,
local  lo,
local  ret 
)
bool luaval_to_ccvaluemapintkey ( lua_State *  L,
int  lo,
cocos2d::ValueMapIntKey ret 
)
var luaval_to_ccvaluemapintkey ( var  L,
var  lo,
var  ret 
)
local luaval_to_ccvaluemapintkey ( local  L,
local  lo,
local  ret 
)
bool luaval_to_ccvaluevector ( lua_State *  L,
int  lo,
cocos2d::ValueVector ret 
)
var luaval_to_ccvaluevector ( var  L,
var  lo,
var  ret 
)
local luaval_to_ccvaluevector ( local  L,
local  lo,
local  ret 
)
bool luaval_to_object ( lua_State *  L,
int  lo,
const char *  type,
T **  ret 
)
var luaval_to_object ( var  L,
var  lo,
var  type,
var  ret 
)
local luaval_to_object ( local  L,
local  lo,
local  type,
local  ret 
)
void vec2_to_luaval ( lua_State *  L,
const cocos2d::Vec2 &  vec2 
)
var vec2_to_luaval ( var  L,
var  vec2 
)
local vec2_to_luaval ( local  L,
local  vec2 
)
void vec3_to_luaval ( lua_State *  L,
const cocos2d::Vec3 &  vec3 
)
var vec3_to_luaval ( var  L,
var  vec3 
)
local vec3_to_luaval ( local  L,
local  vec3 
)
void vec2_array_to_luaval ( lua_State *  L,
const cocos2d::Vec2 *  points,
int  count 
)
var vec2_array_to_luaval ( var  L,
var  points,
var  count 
)
local vec2_array_to_luaval ( local  L,
local  points,
local  count 
)
void size_to_luaval ( lua_State *  L,
const Size sz 
)
var size_to_luaval ( var  L,
var  sz 
)
local size_to_luaval ( local  L,
local  sz 
)
void rect_to_luaval ( lua_State *  L,
const Rect rt 
)
var rect_to_luaval ( var  L,
var  rt 
)
local rect_to_luaval ( local  L,
local  rt 
)
void color3b_to_luaval ( lua_State *  L,
const Color3B cc 
)
var color3b_to_luaval ( var  L,
var  cc 
)
local color3b_to_luaval ( local  L,
local  cc 
)
void color4b_to_luaval ( lua_State *  L,
const Color4B cc 
)
var color4b_to_luaval ( var  L,
var  cc 
)
local color4b_to_luaval ( local  L,
local  cc 
)
void color4f_to_luaval ( lua_State *  L,
const Color4F cc 
)
var color4f_to_luaval ( var  L,
var  cc 
)
local color4f_to_luaval ( local  L,
local  cc 
)
void physics_material_to_luaval ( lua_State *  L,
const PhysicsMaterial &  pm 
)
var physics_material_to_luaval ( var  L,
var  pm 
)
local physics_material_to_luaval ( local  L,
local  pm 
)
void physics_raycastinfo_to_luaval ( lua_State *  L,
const PhysicsRayCastInfo &  info 
)
var physics_raycastinfo_to_luaval ( var  L,
var  info 
)
local physics_raycastinfo_to_luaval ( local  L,
local  info 
)
void physics_contactdata_to_luaval ( lua_State *  L,
const PhysicsContactData *  data 
)
var physics_contactdata_to_luaval ( var  L,
var  data 
)
local physics_contactdata_to_luaval ( local  L,
local  data 
)
void affinetransform_to_luaval ( lua_State *  L,
const AffineTransform inValue 
)
var affinetransform_to_luaval ( var  L,
var  inValue 
)
local affinetransform_to_luaval ( local  L,
local  inValue 
)
void fontdefinition_to_luaval ( lua_State *  L,
const FontDefinition inValue 
)
var fontdefinition_to_luaval ( var  L,
var  inValue 
)
local fontdefinition_to_luaval ( local  L,
local  inValue 
)
void array_to_luaval ( lua_State *  L,
__Array inValue 
)
var array_to_luaval ( var  L,
var  inValue 
)
local array_to_luaval ( local  L,
local  inValue 
)
void dictionary_to_luaval ( lua_State *  L,
__Dictionary dict 
)
var dictionary_to_luaval ( var  L,
var  dict 
)
local dictionary_to_luaval ( local  L,
local  dict 
)
void mat4_to_luaval ( lua_State *  L,
const cocos2d::Mat4 &  mat 
)
var mat4_to_luaval ( var  L,
var  mat 
)
local mat4_to_luaval ( local  L,
local  mat 
)
void blendfunc_to_luaval ( lua_State *  L,
const cocos2d::BlendFunc func 
)
var blendfunc_to_luaval ( var  L,
var  func 
)
local blendfunc_to_luaval ( local  L,
local  func 
)
void ttfconfig_to_luaval ( lua_State *  L,
const cocos2d::TTFConfig &  config 
)
var ttfconfig_to_luaval ( var  L,
var  config 
)
local ttfconfig_to_luaval ( local  L,
local  config 
)
void ccvector_to_luaval ( lua_State *  L,
const cocos2d::Vector< T > &  inValue 
)
var ccvector_to_luaval ( var  L,
var  inValue 
)
local ccvector_to_luaval ( local  L,
local  inValue 
)
void ccmap_string_key_to_luaval ( lua_State *  L,
const cocos2d::Map< std::string, T > &  v 
)
var ccmap_string_key_to_luaval ( var  L,
var  v 
)
local ccmap_string_key_to_luaval ( local  L,
local  v 
)
void ccvalue_to_luaval ( lua_State *  L,
const cocos2d::Value inValue 
)
var ccvalue_to_luaval ( var  L,
var  inValue 
)
local ccvalue_to_luaval ( local  L,
local  inValue 
)
void ccvaluemap_to_luaval ( lua_State *  L,
const cocos2d::ValueMap inValue 
)
var ccvaluemap_to_luaval ( var  L,
var  inValue 
)
local ccvaluemap_to_luaval ( local  L,
local  inValue 
)
void ccvaluemapintkey_to_luaval ( lua_State *  L,
const cocos2d::ValueMapIntKey inValue 
)
var ccvaluemapintkey_to_luaval ( var  L,
var  inValue 
)
local ccvaluemapintkey_to_luaval ( local  L,
local  inValue 
)
void ccvaluevector_to_luaval ( lua_State *  L,
const cocos2d::ValueVector inValue 
)
var ccvaluevector_to_luaval ( var  L,
var  inValue 
)
local ccvaluevector_to_luaval ( local  L,
local  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.

var getLuaTypeName ( var  ret,
var  type 
)

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

local getLuaTypeName ( local  ret,
local  type 
)

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

void object_to_luaval ( lua_State *  L,
const char *  type,
T *  ret 
)
var object_to_luaval ( var  L,
var  type,
var  ret 
)
local object_to_luaval ( local  L,
local  type,
local  ret 
)

Variable Documentation

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