コード例 #1
0
static int tolua_oneself_ScrollViewEx_unregisterScriptHandlerSelf( lua_State* tolua_S )
{
	if ( NULL == tolua_S )
		return 0;

	int argc = 0;
	ScrollViewEx* self = nullptr;

#if COCOS2D_DEBUG >= 1
	tolua_Error tolua_err;
	if ( !tolua_isusertype( tolua_S, 1, "ScrollViewEx", 0, &tolua_err ) ) goto tolua_lerror;
#endif

	self = static_cast<ScrollViewEx*>(tolua_tousertype( tolua_S, 1, 0 ));

#if COCOS2D_DEBUG >= 1
	if ( nullptr == self ) {
		tolua_error( tolua_S, "invalid 'self' in function 'tolua_oneself_ScrollViewEx_unregisterScriptHandlerSelf'\n", NULL );
		return 0;
	}
#endif

	argc = lua_gettop( tolua_S ) - 1;

	if ( 1 == argc )
	{
#if COCOS2D_DEBUG >= 1
		if ( !tolua_isnumber( tolua_S, 2, 0, &tolua_err ) )
			goto tolua_lerror;
#endif
		ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber( tolua_S, 2, 0 ));
		ScriptHandlerMgr::getInstance()->removeObjectHandler( (void*)self, handlerType );
		return 0;
	}

	luaL_error( tolua_S, "%s function of ScrollViewEx  has wrong number of arguments: %d, was expecting %d\n", "my.ScrollViewEx:unregisterScriptHandlerSelf", argc, 1 );
	return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
	tolua_error( tolua_S, "#ferror in function 'tolua_oneself_ScrollViewEx_unregisterScriptHandlerSelf'.", &tolua_err );
	return 0;
#endif
}
コード例 #2
0
static int tolua_cocos2d_ScrollView_unregisterScriptHandler(lua_State* tolua_S)
{
    if (NULL == tolua_S)
        return 0;

    int argc = 0;
    ScrollView* self = nullptr;

#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (!tolua_isusertype(tolua_S,1,"cc.ScrollView",0,&tolua_err)) goto tolua_lerror;
#endif

    self = static_cast<ScrollView*>(tolua_tousertype(tolua_S,1,0));

#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_ScrollView_unregisterScriptHandler'\n", NULL);
        return 0;
    }
#endif

    argc = lua_gettop(tolua_S) - 1;

    if (1 == argc)
    {
#if COCOS2D_DEBUG >= 1
        if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
            goto tolua_lerror;
#endif
        ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(tolua_S,2,0) + (int)ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
        ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerType);
        return 0;
    }

    CCLOG("'unregisterScriptHandler' function of ScrollView  has wrong number of arguments: %d, was expecting %d\n", argc, 1);
    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'unregisterScriptHandler'.",&tolua_err);
    return 0;
#endif
}
コード例 #3
0
static int lua_cocos2d_TableView_unregisterScriptHandler(lua_State* L)
{
    if (NULL == L)
        return 0;
    
    int argc = 0;
    TableView* self = nullptr;
    
#ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
	if (!tolua_isusertype(L,1,"cc.TableView",0,&tolua_err)) goto tolua_lerror;
#endif
    
    self = static_cast<TableView*>(tolua_tousertype(L,1,0));
    
#ifndef TOLUA_RELEASE
	if (nullptr == self) {
		tolua_error(L,"invalid 'self' in function 'lua_cocos2d_TableView_unregisterScriptHandler'\n", NULL);
		return 0;
	}
#endif
    
    argc = lua_gettop(L) - 1;
    
    if (1 == argc)
    {
#ifndef TOLUA_RELEASE
        if (!tolua_isnumber(L, 2, 0, &tolua_err))
            goto tolua_lerror;
#endif
        ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(L,2,0) + (int)ScriptHandlerMgr::HandlerType::SCROLLVIEW_SCROLL);
        ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerType);
        return 0;
    }
    
    luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n", "cc.TableView:unregisterScriptHandler", argc, 0);
    return 0;
    
#ifndef TOLUA_RELEASE
tolua_lerror:
    tolua_error(L,"#ferror in function 'lua_cocos2d_TableView_unregisterScriptHandler'.",&tolua_err);
    return 0;
#endif
}
コード例 #4
0
int baseobject_change_type(lua_State* L)
{
#ifdef _DEBUG
	tolua_Error err;
	if(!tolua_isusertype(L,1,"CBaseObject",0,&err)||
		!tolua_isnumber(L,2,0,&err)||
		!tolua_isnoobj(L,3,&err) )
	{
		tolua_error(L,"#ferror in function 'baseobject_change_type'.",&err);
		return 0;
	}
#endif
	CBaseObject* pObject = (CBaseObject*)tolua_tousertype(L,1,0);
	if( pObject )
	{
		long lType = (long)tolua_tonumber(L,2,0);
		switch(lType)
		{
		case	TYPE_MONSTER:
			{
				CMonster* pMonster = dynamic_cast<CMonster*>(pObject);
				tolua_pushusertype(L,pMonster,"CMonster");
			}
			return 1;
		case	TYPE_GOODS:
			{
				CGoods* pGoods = dynamic_cast<CGoods*>(pObject);
				tolua_pushusertype(L,pGoods,"CGoods");
			}
			return 1;
		case	TYPE_PLAYER:
			{
				CPlayer* pPlayer = dynamic_cast<CPlayer*>(pObject);
				tolua_pushusertype(L,pPlayer,"CPlayer");
			}
			return 1;
		default:
			tolua_pushboolean(L,false);
			break;
		}
	}
	return 1;
}
コード例 #5
0
ファイル: lua_ftk_entry.c プロジェクト: htbegin/pyftk
static int lua_ftk_entry_insert_text(lua_State* L)
{
	tolua_Error err = {0};
	Ret retv;
	FtkWidget* thiz;
	int pos;
	char* text;
	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isstring(L, 3, 0, &err);

	return_val_if_fail(param_ok, 0);

	thiz = tolua_tousertype(L, 1, 0);
	pos = tolua_tonumber(L, 2, 0);
	text = (char*)tolua_tostring(L, 3, 0);
	retv = ftk_entry_insert_text(thiz, pos, text);
	tolua_pushnumber(L, (lua_Number)retv);

	return 1;
}
コード例 #6
0
ファイル: lua_ftk_sprite.c プロジェクト: bbw2008good/ftk
static int lua_ftk_sprite_move(lua_State* L)
{
	tolua_Error err = {0};
	Ret retv;
	FtkSprite* thiz;
	int x;
	int y;
	int param_ok = tolua_isusertype(L, 1, "FtkSprite", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);

	return_val_if_fail(param_ok, 0);

	thiz = tolua_tousertype(L, 1, 0);
	x = tolua_tonumber(L, 2, 0);
	y = tolua_tonumber(L, 3, 0);
	retv = ftk_sprite_move(thiz, x, y);
	tolua_pushnumber(L, (lua_Number)retv);

	return 1;
}
コード例 #7
0
static int tolua_get_AllToLua_g_BlockLightValue(lua_State* tolua_S)
{
	int BlockType;
	#ifndef TOLUA_RELEASE
	{
		tolua_Error tolua_err;
		if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
		{
			tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
		}
	}
	#endif
	BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
	if ((BlockType < 0) || (BlockType > E_BLOCK_MAX_TYPE_ID))
	{
		tolua_error(tolua_S, "array indexing out of range.", nullptr);
	}
	tolua_pushnumber(tolua_S, (lua_Number)cBlockInfo::GetLightValue((BLOCKTYPE)BlockType));
	return 1;
}
コード例 #8
0
int lua_register_sls_world_getSloth(lua_State* tolua_S)
{
  int argc = 0;
  sls::World* cobj = nullptr;

  cobj = (sls::World*)tolua_tousertype(tolua_S,1,0);
  if (!cobj) return 0;

  argc = lua_gettop(tolua_S) - 1;
  if (argc == 1) {
    tolua_Error tolua_err;
    if (tolua_isnumber(tolua_S,2,0,&tolua_err)) {
      int val = tolua_tonumber(tolua_S, 2, 0);
      sls::Sloth* ret = &(cobj->getSloth(val));
      tolua_pushusertype(tolua_S,(void*)ret,"sls.Sloth");
      return 1;
    }
  }
  return 0;
}
コード例 #9
0
static int tolua_Cocos2dx_CCScrollView_registerScriptHandler(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
        !tolua_isusertype(tolua_S,1,"CCScrollView",0,&tolua_err) ||
        !toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err) ||
        !tolua_isnumber(tolua_S, 3, 0, &tolua_err)               ||
        !tolua_isnoobj(tolua_S,4,&tolua_err)
        )
        goto tolua_lerror;
    else
#endif
    {
        CCScrollView* self = (CCScrollView*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
        if (!self) tolua_error(tolua_S,"invalid 'self' in function 'registerScriptHandler'", NULL);
#endif
        if (NULL == self->getDelegate())
        {
            LuaScrollViewDelegate* delegate = new LuaScrollViewDelegate();
            if (NULL == delegate)
                return 0;
            
            self->setUserObject(delegate);
            self->setDelegate(delegate);
            
            delegate->release();
        }
        
        LUA_FUNCTION nFunID = (  toluafix_ref_function(tolua_S,2,0));
        int scriptHandlerType = ((int)  tolua_tonumber(tolua_S,3,0));
        self->registerScriptHandler(nFunID,scriptHandlerType);
    }
    return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
    return 0;
#endif
}
コード例 #10
0
int player_trade_open_trade_dialog(lua_State* L)
{
#ifdef _DEBUG
	tolua_Error err;
	if(	!tolua_isusertype(L,1,"CPlayerTrade",0,&err) ||
		!tolua_isusertype(L,2,"CGameClient",0,&err)||
		!tolua_isnumber(L,3,0,&err)||
		!tolua_isnoobj(L,4,&err) )
	{
		tolua_error(L,"#ferror in function 'player_open_trade_dialog'.",&err);
		return 0;
	}
#endif
	CPlayerTrade* selfTrade = (CPlayerTrade*)tolua_tousertype(L,1,0);
	CGameClient* selfClient = (CGameClient*)tolua_tousertype(L,2,0);
	long bRet = (long)tolua_tonumber(L,3,0);
	if(bRet ==1)
	{
		selfTrade->OpenTradeDialog(selfClient);
	}
	return 0;
}
コード例 #11
0
static int lua_set_AudioProfile_minDelay(lua_State* L)
{
    int argc = 0;
    cocos2d::experimental::AudioProfile* self = nullptr;

#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (!tolua_isusertype(L,1,"ccexp.AudioProfile",0,&tolua_err)) goto tolua_lerror;
#endif

    self = (cocos2d::experimental::AudioProfile*)  tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
    if (nullptr == self)
    {
        tolua_error(L,"invalid 'self' in function 'lua_set_AudioProfile_minDelay'\n", nullptr);
        return 0;
    }
#endif

    argc = lua_gettop(L) - 1;

    if (1 == argc)
    {
#if COCOS2D_DEBUG >= 1
        if (!tolua_isnumber(L, 2, 0, &tolua_err))
            goto tolua_lerror;
#endif
        self->minDelay = tolua_tonumber(L, 2, 0);
        return 0;
    }

    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(L,"#ferror in function 'lua_set_AudioProfile_minDelay'.",&tolua_err);
    return 0;
#endif
}
コード例 #12
0
ファイル: tarraybind.c プロジェクト: ConnorShore/Game
/* set function: pp of class  Array */
static int tolua_set_tarray_Array_pp(lua_State* tolua_S)
{
 int tolua_index;
  Array* self;
 lua_pushstring(tolua_S,".self");
 lua_rawget(tolua_S,1);
 self = (Array*)  lua_touserdata(tolua_S,-1);
#ifndef TOLUA_RELEASE
 {
 tolua_Error tolua_err;
 if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
 tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);
 }
#endif
 tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;
#ifndef TOLUA_RELEASE
 if (tolua_index<0 || tolua_index>=10)
 tolua_error(tolua_S,"array indexing out of range.",NULL);
#endif
  self->pp[tolua_index] = ((Point*)  tolua_tousertype(tolua_S,3,0));
 return 0;
}
コード例 #13
0
static int tolua_glu_gluScaleImage00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isusertype(tolua_S,5,"GLLbuffer",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,7,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,8,0,&tolua_err) ||
     !tolua_isusertype(tolua_S,9,"GLLbuffer",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,10,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
   int format = ((  int)  tolua_tonumber(tolua_S,1,0));
   int widthin = ((  int)  tolua_tonumber(tolua_S,2,0));
   int heightin = ((  int)  tolua_tonumber(tolua_S,3,0));
   int typein = ((  int)  tolua_tonumber(tolua_S,4,0));
  GLLbuffer* datain = ((GLLbuffer*)  tolua_tousertype(tolua_S,5,0));
   int widthout = ((  int)  tolua_tonumber(tolua_S,6,0));
   int heightout = ((  int)  tolua_tonumber(tolua_S,7,0));
   int typeout = ((  int)  tolua_tonumber(tolua_S,8,0));
  GLLbuffer* dataout = ((GLLbuffer*)  tolua_tousertype(tolua_S,9,0));
  {
    int tolua_ret = (  int)  gluScaleImage(format,widthin,heightin,typein,datain,widthout,heightout,typeout,dataout);
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'gluScaleImage'.",&tolua_err);
 return 0;
#endif
}
コード例 #14
0
bool luaval_to_int32(lua_State* L,int lo,int* outValue, const char* funcName)
{
    if (NULL == L || NULL == outValue)
        return false;

    bool ok = true;

    tolua_Error tolua_err;
    if (!tolua_isnumber(L,lo,0,&tolua_err))
    {
#if COCOS2D_DEBUG >=1
        luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
        ok = false;
    }

    if (ok)
    {
        /**
         When we want to convert the number value from the Lua to int, we would call lua_tonumber to implement.It would
         experience two phase conversion: int -> double, double->int.But,for the 0x80000000 which the min value of int, the
         int cast may return an undefined result,like 0x7fffffff.So we must use the (int)(unsigned int)lua_tonumber() to get
         predictable results for 0x80000000.In this place,we didn't use lua_tointeger, because it may produce differen results
         depending on the compiler,e.g:for iPhone4s,it also get wrong value for 0x80000000.
         */
        unsigned int estimateValue = (unsigned int)lua_tonumber(L, lo);
        if (estimateValue == std::numeric_limits<int>::min())
        {
            *outValue = (int)estimateValue;
        }
        else
        {
            *outValue = (int)lua_tonumber(L, lo);
        }
    }

    return ok;
}
コード例 #15
0
bool luaval_to_ushort(lua_State* L, int lo, unsigned short* outValue, const char* funcName)
{
    if (NULL == L || NULL == outValue)
        return false;

    bool ok = true;

    tolua_Error tolua_err;
    if (!tolua_isnumber(L,lo,0,&tolua_err))
    {
#if COCOS2D_DEBUG >=1
        luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
        ok = false;
    }

    if (ok)
    {
        *outValue = (unsigned short)tolua_tonumber(L, lo, 0);
    }

    return ok;
}
コード例 #16
0
static int tolua_dict_set(lua_State * L)
{
    tolua_Error tolua_err;
    if (tolua_isnumber(L, 3, 0, &tolua_err)) {
        return tolua_dict_set_number(L);
    }
    else if (tolua_isusertype(L, 3, TOLUA_CAST "unit", 0, &tolua_err)) {
        return tolua_dict_set_usertype(L, TUNIT);
    }
    else if (tolua_isusertype(L, 3, TOLUA_CAST "faction", 0, &tolua_err)) {
        return tolua_dict_set_usertype(L, TFACTION);
    }
    else if (tolua_isusertype(L, 3, TOLUA_CAST "ship", 0, &tolua_err)) {
        return tolua_dict_set_usertype(L, TSHIP);
    }
    else if (tolua_isusertype(L, 3, TOLUA_CAST "building", 0, &tolua_err)) {
        return tolua_dict_set_usertype(L, TBUILDING);
    }
    else if (tolua_isusertype(L, 3, TOLUA_CAST "region", 0, &tolua_err)) {
        return tolua_dict_set_usertype(L, TREGION);
    }
    return tolua_dict_set_string(L);
}
コード例 #17
0
static int tolua_MessageHandler_pvp_changeSeat(lua_State *tolua_S)
{
#ifndef TOLUA_TXGUI_RELEASE
	tolua_Error tolua_err;
	if(
       !tolua_isusertype(tolua_S,1,"MessageHandler",0,&tolua_err) ||
       !tolua_isnumber(tolua_S, 2, 0, &tolua_err) ||
       !tolua_isnoobj(tolua_S,3,&tolua_err)
       )
	{
		tolua_error(tolua_S,"#ferror in function 'MessageHandler::kickOffFromRoom'",&tolua_err);
		return 0;
	}
#endif
    
	MessageHandler* self = (MessageHandler*)tolua_tousertype(tolua_S,1,0);
	if (self)
	{
		int seat = tolua_tonumber(tolua_S, 2, 0);
		PVPMessage::Get()->pvp_changeSeat(seat);
	}
	return 1;
}
コード例 #18
0
ファイル: lua_ftk_text_view.c プロジェクト: bbw2008good/ftk
static int lua_ftk_text_view_create(lua_State* L)
{
	tolua_Error err = {0};
	FtkTextView* retv;
	FtkWidget* parent;
	int x;
	int y;
	int width;
	int height;
	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err) && tolua_isnumber(L, 5, 0, &err);

	return_val_if_fail(param_ok, 0);

	parent = tolua_tousertype(L, 1, 0);
	x = tolua_tonumber(L, 2, 0);
	y = tolua_tonumber(L, 3, 0);
	width = tolua_tonumber(L, 4, 0);
	height = tolua_tonumber(L, 5, 0);
	retv = ftk_text_view_create(parent, x, y, width, height);
	tolua_pushusertype(L, (FtkTextView*)retv, "FtkTextView");

	return 1;
}
コード例 #19
0
static int tolua__IntensityCEGUI_luaSetRightWeaponSparkle00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
 !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
 !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
 goto tolua_lerror;
 else
#endif
 {
  int id = ((int)  tolua_tonumber(tolua_S,1,0));
 {
  IntensityCEGUI::luaSetRightWeaponSparkle(id);
 }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'luaSetRightWeaponSparkle'.",&tolua_err);
 return 0;
#endif
}
コード例 #20
0
ファイル: gl_lua.c プロジェクト: ennorehling/eagle
static int tolua_gl_gl_glClear00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  unsigned int tolua_var_5 = ((unsigned int)  tolua_tonumber(tolua_S,1,0));
  {
   glClear(tolua_var_5);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'glClear'.",&tolua_err);
 return 0;
#endif
}
コード例 #21
0
static int tolua__IntensityCEGUI_luaFocusOnEntity00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
 !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
 !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
 goto tolua_lerror;
 else
#endif
 {
  int uniqueId = ((int)  tolua_tonumber(tolua_S,1,0));
 {
  IntensityCEGUI::luaFocusOnEntity(uniqueId);
 }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'luaFocusOnEntity'.",&tolua_err);
 return 0;
#endif
}
コード例 #22
0
static int tolua_glu_gluBuild2DMipmaps00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
     !tolua_isusertype(tolua_S,7,"GLLbuffer",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,8,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
   int target = ((  int)  tolua_tonumber(tolua_S,1,0));
   int components = ((  int)  tolua_tonumber(tolua_S,2,0));
   int width = ((  int)  tolua_tonumber(tolua_S,3,0));
   int height = ((  int)  tolua_tonumber(tolua_S,4,0));
   int format = ((  int)  tolua_tonumber(tolua_S,5,0));
   int type = ((  int)  tolua_tonumber(tolua_S,6,0));
  GLLbuffer* data = ((GLLbuffer*)  tolua_tousertype(tolua_S,7,0));
  {
    int tolua_ret = (  int)  gluBuild2DMipmaps(target,components,width,height,format,type,data);
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'gluBuild2DMipmaps'.",&tolua_err);
 return 0;
#endif
}
コード例 #23
0
static int tolua_glu_gluPartialDisk00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"GLUquadricObj",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,7,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,8,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  GLUquadricObj* qobj = ((GLUquadricObj*)  tolua_tousertype(tolua_S,1,0));
   double innerRadius = ((  double)  tolua_tonumber(tolua_S,2,0));
   double outerRadius = ((  double)  tolua_tonumber(tolua_S,3,0));
   int slices = ((  int)  tolua_tonumber(tolua_S,4,0));
   int loops = ((  int)  tolua_tonumber(tolua_S,5,0));
   double startAngle = ((  double)  tolua_tonumber(tolua_S,6,0));
   double sweepAngle = ((  double)  tolua_tonumber(tolua_S,7,0));
  {
   gluPartialDisk(qobj,innerRadius,outerRadius,slices,loops,startAngle,sweepAngle);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'gluPartialDisk'.",&tolua_err);
 return 0;
#endif
}
コード例 #24
0
static int tolua_cocos2dx_AttackArea_drawSolidPolygon(lua_State* tolua_S)
{
    if (NULL == tolua_S)
        return 0;
    
    int argc = 0;
    AttackArea* self = nullptr;
    
    tolua_Error tolua_err;
#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(tolua_S,1,"AttackArea",0,&tolua_err)) goto tolua_lerror;
#endif
    
    self = static_cast<AttackArea*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_AttackArea_drawSolidPolygon'\n", NULL);
        return 0;
    }
#endif
    
    argc = lua_gettop(tolua_S) - 1;
    if (3 == argc)
    {
#if COCOS2D_DEBUG >= 1
        if(
           !tolua_istable(tolua_S, 2, 0, &tolua_err)  ||
           !tolua_isnumber(tolua_S, 3, 0, &tolua_err) ||
           !tolua_istable(tolua_S, 4, 0,&tolua_err) )
        {
            goto tolua_lerror;
        }
#endif
        size_t size = lua_tonumber(tolua_S, 3);
        if ( size > 0 )
        {
            cocos2d::Vec2* points = new cocos2d::Vec2[size];
            if (NULL == points)
                return 0;
            
            for (int i = 0; i < size; i++)
            {
                lua_pushnumber(tolua_S,i + 1);
                lua_gettable(tolua_S,2);
                if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
                {
                    CC_SAFE_DELETE_ARRAY(points);
#if COCOS2D_DEBUG >= 1
                    goto tolua_lerror;
#endif
                }
                
                if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "AttackArea:drawSolidPolygon"))
                {
                    lua_pop(tolua_S, 1);
                    CC_SAFE_DELETE_ARRAY(points);
                    return 0;
                }
                lua_pop(tolua_S, 1);
            }
            
            Color4F fillColor;
            if (!luaval_to_color4f(tolua_S, 4, &fillColor, "AttackArea:drawPolygon"))
            {
                CC_SAFE_DELETE_ARRAY(points);
                return 0;
            }

            self->drawSolidPolygon(points, (int)size, fillColor);
            CC_SAFE_DELETE_ARRAY(points);
            return 0;
        }
    }
    
    CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "AttackArea:drawSolidPolygon", argc, 3);
    return 0;
    
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_DrawNode_drawSolidPolygon'.",&tolua_err);
    return 0;
#endif
}
コード例 #25
0
ファイル: lua_ftk_text_view.c プロジェクト: bbw2008good/ftk
static int lua_ftk_text_view_set_text(lua_State* L)
{
	tolua_Error err = {0};
	Ret retv;
	FtkWidget* thiz;
	const char* text;
	int len;
	int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err);

	return_val_if_fail(param_ok, 0);

	thiz = tolua_tousertype(L, 1, 0);
	text = tolua_tostring(L, 2, 0);
	len = tolua_tonumber(L, 3, 0);
	retv = ftk_text_view_set_text(thiz, text, len);
	tolua_pushnumber(L, (lua_Number)retv);

	return 1;
}
コード例 #26
0
static int tolua_cocos2dx_EventListenerPhysicsContact_registerScriptHandler(lua_State* tolua_S)
{
    if (nullptr == tolua_S)
        return 0;
    
    int argc = 0;
    EventListenerPhysicsContact* self = nullptr;
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (!tolua_isusertype(tolua_S, 1, "cc.EventListenerPhysicsContact", 0, &tolua_err))  goto tolua_lerror;
#endif
    
    self = static_cast<EventListenerPhysicsContact*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_EventListenerPhysicsContact_registerScriptHandler'\n", nullptr);
        return 0;
    }
#endif
    argc = lua_gettop(tolua_S) - 1;
    
    if (argc == 2)
    {
#if COCOS2D_DEBUG >= 1
        if (!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err) ||
            !tolua_isnumber(tolua_S, 3, 0, &tolua_err))
        {
            goto tolua_lerror;
        }
#endif
        LUA_FUNCTION handler = toluafix_ref_function(tolua_S,2,0);
        ScriptHandlerMgr::HandlerType type        = static_cast<ScriptHandlerMgr::HandlerType>((int)tolua_tonumber(tolua_S, 3, 0));
        switch (type)
        {
            case ScriptHandlerMgr::HandlerType::EVENT_PHYSICS_CONTACT_BEGIN:
            {
                ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                
                self->onContactBegin = [handler](PhysicsContact& contact) -> bool{
                    LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
                    stack->pushObject(&contact, "cc.PhysicsContact");
                    bool ret = stack->executeFunctionByHandler(handler, 1);
                    stack->clean();
                    
                    return ret;
                };
            }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_PHYSICS_CONTACT_PRESOLVE:
            {
                ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                
                self->onContactPreSolve = [handler](PhysicsContact& contact, PhysicsContactPreSolve& solve) -> bool{
                    LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
                    stack->pushObject(&contact, "cc.PhysicsContact");
                    tolua_pushusertype(stack->getLuaState(), &solve, "cc.PhysicsContactPreSolve");
                    bool ret = stack->executeFunctionByHandler(handler, 2);
                    stack->clean();
                    
                    return ret;
                };
            }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_PHYSICS_CONTACT_POSTSOLVE:
            {
                ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                
                self->onContactPostSolve = [handler](PhysicsContact& contact, const PhysicsContactPostSolve& solve){
                    LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
                    stack->pushObject(&contact, "cc.PhysicsContact");
                    tolua_pushusertype(stack->getLuaState(), const_cast<PhysicsContactPostSolve*>(&solve), "cc.PhysicsContactPostSolve");
                    stack->executeFunctionByHandler(handler, 2);
                    stack->clean();
                };
            }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_PHYSICS_CONTACT_SEPERATE:
            {
                ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                
                self->onContactSeperate = [handler](PhysicsContact& contact){
                    LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
                    stack->pushObject(&contact, "cc.PhysicsContact");
                    stack->executeFunctionByHandler(handler, 1);
                    stack->clean();
                };
            }
                break;
            default:
                break;
        }
        return 0;
    }
    
    CCLOG("'registerScriptHandler' has wrong number of arguments: %d, was expecting %d\n", argc, 2);
    return 0;
    
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
    return 0;
#endif
}
コード例 #27
0
static int lua_cocos2dx_AssetsManager_setDelegate(lua_State* L)
{
    if (nullptr == L)
        return 0;

    int argc = 0;
    AssetsManager* self = nullptr;

#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (!tolua_isusertype(L,1,"cc.AssetsManager",0,&tolua_err)) goto tolua_lerror;
#endif

    self = (AssetsManager*)  tolua_tousertype(L,1,0);

#if COCOS2D_DEBUG >= 1
    if (nullptr == self)
    {
        tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_AssetsManager_setDelegate'\n", nullptr);
        return 0;
    }
#endif

    argc = lua_gettop(L) - 1;

    if (2 == argc)
    {
#if COCOS2D_DEBUG >= 1
        if (!toluafix_isfunction(L, 2, "LUA_FUNCTION", 0, &tolua_err) ||
                !tolua_isnumber(L, 3, 0, &tolua_err) )
        {
            goto tolua_lerror;
        }
#endif
        LuaAssetsManagerDelegateProtocol* delegate = dynamic_cast<LuaAssetsManagerDelegateProtocol*>( self->getDelegate());
        if (nullptr == delegate)
        {
            delegate = new (std::nothrow) LuaAssetsManagerDelegateProtocol();
            if (nullptr == delegate)
                return 0;

            self->setUserObject(delegate);
            self->setDelegate(delegate);
            delegate->release();
        }

        LUA_FUNCTION handler = toluafix_ref_function(L, 2, 0);
        ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType) ((int)tolua_tonumber(L,3,0) + (int)ScriptHandlerMgr::HandlerType::ASSETSMANAGER_PROGRESS);

        ScriptHandlerMgr::getInstance()->addObjectHandler((void*)delegate, handler, handlerType);
        return 0;
    }

    luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n", "cc.AssetsManager:setDelegate", argc, 2);
    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(L,"#ferror in function 'lua_cocos2dx_AssetsManager_setDelegate'.",&tolua_err);
    return 0;
#endif
}
static int tolua_cocos2dx_NVGDrawNode_setPoints(lua_State* tolua_S)
{
    if (NULL == tolua_S)
        return 0;

    int argc = 0;
    cocos2d::extension::NVGDrawNode* self = nullptr;

    tolua_Error tolua_err;
#if COCOS2D_DEBUG >= 1
    if (!tolua_isusertype(tolua_S,1,"cc.NVGDrawNode",0,&tolua_err)) goto tolua_lerror;
#endif

    self = static_cast<cocos2d::extension::NVGDrawNode*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
        tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_NVGDrawNode_setPoints'\n", NULL);
        return 0;
    }
#endif

    argc = lua_gettop(tolua_S) - 1;
    if (2 == argc)
    {
#if COCOS2D_DEBUG >= 1
        if(
            !tolua_istable(tolua_S, 2, 0, &tolua_err)  ||
            !tolua_isnumber(tolua_S, 3, 0, &tolua_err) )
        {
            goto tolua_lerror;
        }
#endif
        size_t size = lua_tonumber(tolua_S, 3);
        if ( size > 0 )
        {
            cocos2d::Vec2* points = new cocos2d::Vec2[size];
            if (NULL == points)
                return 0;

            for (int i = 0; i < size; i++)
            {
                lua_pushnumber(tolua_S,i + 1);
                lua_gettable(tolua_S,2);
                if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
                {
                    CC_SAFE_DELETE_ARRAY(points);
#if COCOS2D_DEBUG >= 1
                    goto tolua_lerror;
#endif
                }

                if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.NVGDrawNode:setPoints"))
                {
                    lua_pop(tolua_S, 1);
                    CC_SAFE_DELETE_ARRAY(points);
                    return 0;
                }
                lua_pop(tolua_S, 1);
            }

            self->setPoints(points, (int)size);
            CC_SAFE_DELETE_ARRAY(points);
            return 0;
        }
    }

    CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.NVGDrawNode:setPoints", argc, 2);
    return 0;

#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_NVGDrawNode_setPoints'.",&tolua_err);
    return 0;
#endif
}
コード例 #29
0
static int tolua_glu_gluUnProject00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
     !tolua_istable(tolua_S,4,0,&tolua_err) ||
     !tolua_istable(tolua_S,5,0,&tolua_err) ||
     !tolua_istable(tolua_S,6,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,7,1,&tolua_err) ||
     !tolua_isnumber(tolua_S,8,1,&tolua_err) ||
     !tolua_isnumber(tolua_S,9,1,&tolua_err) ||
     !tolua_isnoobj(tolua_S,10,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
   double winx = ((  double)  tolua_tonumber(tolua_S,1,0));
   double winy = ((  double)  tolua_tonumber(tolua_S,2,0));
   double winz = ((  double)  tolua_tonumber(tolua_S,3,0));
   double modelMatrix[16];
   double projMatrix[16];
   int viewport[4];
   double objx = ((  double)  tolua_tonumber(tolua_S,7,0));
   double objy = ((  double)  tolua_tonumber(tolua_S,8,0));
   double objz = ((  double)  tolua_tonumber(tolua_S,9,0));
  {
#ifndef TOLUA_RELEASE
   if (!tolua_isnumberarray(tolua_S,4,16,0,&tolua_err))
    goto tolua_lerror;
   else
#endif
   {
    int i;
    for(i=0; i<16;i++)
    modelMatrix[i] = ((double)  tolua_tofieldnumber(tolua_S,4,i+1,0));
   }
  }
  {
#ifndef TOLUA_RELEASE
   if (!tolua_isnumberarray(tolua_S,5,16,0,&tolua_err))
    goto tolua_lerror;
   else
#endif
   {
    int i;
    for(i=0; i<16;i++)
    projMatrix[i] = ((double)  tolua_tofieldnumber(tolua_S,5,i+1,0));
   }
  }
  {
#ifndef TOLUA_RELEASE
   if (!tolua_isnumberarray(tolua_S,6,4,0,&tolua_err))
    goto tolua_lerror;
   else
#endif
   {
    int i;
    for(i=0; i<4;i++)
    viewport[i] = ((int)  tolua_tofieldnumber(tolua_S,6,i+1,0));
   }
  }
  {
    int tolua_ret = (  int)  gluUnProject(winx,winy,winz,modelMatrix,projMatrix,viewport,&objx,&objy,&objz);
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
   tolua_pushnumber(tolua_S,(lua_Number)objx);
   tolua_pushnumber(tolua_S,(lua_Number)objy);
   tolua_pushnumber(tolua_S,(lua_Number)objz);
  }
  {
   int i;
   for(i=0; i<16;i++)
    tolua_pushfieldnumber(tolua_S,4,i+1,(lua_Number) modelMatrix[i]);
  }
  {
   int i;
   for(i=0; i<16;i++)
    tolua_pushfieldnumber(tolua_S,5,i+1,(lua_Number) projMatrix[i]);
  }
  {
   int i;
   for(i=0; i<4;i++)
    tolua_pushfieldnumber(tolua_S,6,i+1,(lua_Number) viewport[i]);
  }
 }
 return 4;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'gluUnProject'.",&tolua_err);
 return 0;
#endif
}
コード例 #30
0
static int tolua_cocos2dx_EventListenerController_registerScriptHandler(lua_State* tolua_S)
{
    if (nullptr == tolua_S)
        return 0;
    
    int argc = 0;
    cocos2d::EventListenerController* self = nullptr;
#if COCOS2D_DEBUG >= 1
    tolua_Error tolua_err;
    if (!tolua_isusertype(tolua_S, 1, "cc.EventListenerController", 0, &tolua_err))  goto tolua_lerror;
#endif
    
    self = static_cast<cocos2d::EventListenerController*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
    if (nullptr == self) {
		tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_EventListenerController_registerScriptHandler'\n", nullptr);
		return 0;
	}
#endif
    argc = lua_gettop(tolua_S) - 1;
    
    if (argc == 2)
    {
#if COCOS2D_DEBUG >= 1
        if (!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err) ||
            !tolua_isnumber(tolua_S, 3, 0, &tolua_err))
        {
            goto tolua_lerror;
        }
#endif
        LUA_FUNCTION handler = toluafix_ref_function(tolua_S,2,0);
        ScriptHandlerMgr::HandlerType type        = static_cast<ScriptHandlerMgr::HandlerType>((int)tolua_tonumber(tolua_S, 3, 0));
        
        switch (type)
        {
            case ScriptHandlerMgr::HandlerType::EVENT_CONTROLLER_CONNECTED:
                {
                    ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                    
                    self->onConnected = [=](cocos2d::Controller* controller, Event* event){
                        tolua_pushusertype(tolua_S, (void*)controller, "cc.Controller");
                        int ID = (event) ? (int)event->_ID : -1;
                        int* luaID = (event) ? &event->_luaID : NULL;
                        toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)event,"cc.event");
                        LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
                    };
                }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_CONTROLLER_DISCONNECTED:
                {
                    ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                    
                    self->onDisconnected = [=](cocos2d::Controller* controller, Event* event){
                        tolua_pushusertype(tolua_S, (void*)controller, "cc.Controller");
                        int ID = (event) ? (int)event->_ID : -1;
                        int* luaID = (event) ? &event->_luaID : NULL;
                        toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)event,"cc.event");
                        LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
                    };
                }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_CONTROLLER_KEYDOWN:
                {
                    
                    ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                    
                    self->onKeyDown = [=](cocos2d::Controller* controller, int keyCode, Event* event){
                        tolua_pushusertype(tolua_S, (void*)controller, "cc.Controller");
                        tolua_pushnumber(tolua_S, (lua_Number) keyCode);
                        int ID = (event) ? (int)event->_ID : -1;
                        int* luaID = (event) ? &event->_luaID : NULL;
                        toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)event,"cc.event");
                        LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 3);
                    };
                }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_CONTROLLER_KEYUP:
                {
                    ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                    
                    self->onKeyUp = [=](cocos2d::Controller* controller, int keyCode, Event* event){
                        tolua_pushusertype(tolua_S, (void*)controller, "cc.Controller");
                        tolua_pushnumber(tolua_S, (lua_Number) keyCode);
                        int ID = (event) ? (int)event->_ID : -1;
                        int* luaID = (event) ? &event->_luaID : NULL;
                        toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)event,"cc.event");
                        LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 3);
                    };
                }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_CONTROLLER_KEYREPEAT:
                {
                    ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                    
                    self->onKeyRepeat = [=](cocos2d::Controller* controller, int keyCode, Event* event){
                        tolua_pushusertype(tolua_S, (void*)controller, "cc.Controller");
                        tolua_pushnumber(tolua_S, (lua_Number) keyCode);
                        int ID = (event) ? (int)event->_ID : -1;
                        int* luaID = (event) ? &event->_luaID : NULL;
                        toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)event,"cc.event");
                        LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 3);
                    };
                }
                break;
            case ScriptHandlerMgr::HandlerType::EVENT_CONTROLLER_AXIS:
                {
                    ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, type);
                    
                    self->onAxisEvent = [=](cocos2d::Controller* controller, int keyCode, Event* event){
                        tolua_pushusertype(tolua_S, (void*)controller, "cc.Controller");
                        tolua_pushnumber(tolua_S, (lua_Number) keyCode);
                        int ID = (event) ? (int)event->_ID : -1;
                        int* luaID = (event) ? &event->_luaID : NULL;
                        toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)event,"cc.event");
                        LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 3);
                    };
                }
                break;
            default:
                break;
        }
        return 0;
    }
    
    CCLOG("'registerScriptHandler' has wrong number of arguments: %d, was expecting %d\n", argc, 2);
    return 0;
    
#if COCOS2D_DEBUG >= 1
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err);
    return 0;
#endif
}