这篇教程C++ tolua_tonumber函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tolua_tonumber函数的典型用法代码示例。如果您正苦于以下问题:C++ tolua_tonumber函数的具体用法?C++ tolua_tonumber怎么用?C++ tolua_tonumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tolua_tonumber函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tolua_set_B_b/* set function: A::B::b */static int tolua_set_B_b(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif A::B::b = ((int) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:MoSyncLabs,项目名称:mobilelua,代码行数:11,
示例2: tolua_EQUIPINFO_getEquipHolestatic int tolua_EQUIPINFO_getEquipHole(lua_State *tolua_S){#ifndef TOLUA_TXGUI_RELEASE tolua_Error tolua_err; if(!tolua_isusertype(tolua_S,1,"EQUIPINFO",0,&tolua_err) || !tolua_isnoobj(tolua_S, 2, &tolua_err) ) { tolua_error(tolua_S,"#ferror in function 'EQUIPINFO::getEquipHole'",&tolua_err); return 0; }#endif EQUIPINFO* self = (EQUIPINFO*)tolua_tousertype(tolua_S,1,0); int pos = tolua_tonumber(tolua_S, 2, 0); lua_newtable(tolua_S); for(std::map<unsigned int,EQUIPHOLE>::iterator it = self->m_equipHoles.begin(); it != self->m_equipHoles.end(); ++it) { unsigned int holePos = it->first; EQUIPHOLE hole = it->second; lua_pushnumber(tolua_S,hole.hole_index); lua_newtable(tolua_S); lua_pushstring(tolua_S,"hole_index"); lua_pushnumber(tolua_S,hole.hole_index); lua_settable(tolua_S, -3); lua_pushstring(tolua_S,"item_gem_id"); lua_pushnumber(tolua_S,hole.item_gem_id); lua_settable(tolua_S, -3); lua_pushstring(tolua_S,"attr_key"); lua_pushnumber(tolua_S,hole.attr_key); lua_settable(tolua_S, -3); lua_pushstring(tolua_S,"attr_value"); lua_pushnumber(tolua_S,hole.attr_value); lua_settable(tolua_S, -3); lua_pushstring(tolua_S,"max_value"); lua_pushnumber(tolua_S,hole.max_value); lua_settable(tolua_S, -3); lua_pushstring(tolua_S,"min_value"); lua_pushnumber(tolua_S,hole.min_value); lua_settable(tolua_S, -3); lua_settable(tolua_S, -3); } return 1; }
开发者ID:niuzb,项目名称:hellopetclient,代码行数:55,
示例3: tolua_cocos2d_Control_registerControlEventHandlerstatic int tolua_cocos2d_Control_registerControlEventHandler(lua_State* tolua_S){ if (NULL == tolua_S) return 0; int argc = 0; Control* self = nullptr;#if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; if (!tolua_isusertype(tolua_S,1,"cc.Control",0,&tolua_err)) goto tolua_lerror;#endif self = static_cast<Control*>(tolua_tousertype(tolua_S,1,0));#if COCOS2D_DEBUG >= 1 if (nullptr == self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_Control_registerControlEventHandler'/n", NULL); return 0; }#endif argc = lua_gettop(tolua_S) - 1; if (2 == argc) {#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)); int controlevent = (int)tolua_tonumber(tolua_S,3,0); for (int i = 0; i < kControlEventTotalNumber; i++) { if ((controlevent & (1 << i))) { ScriptHandlerMgr::HandlerType handlerevent = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i); ScriptHandlerMgr::getInstance()->addObjectHandler((void*)self, handler, handlerevent); } } return 0; } luaL_error(tolua_S, "%s function of Control has wrong number of arguments: %d, was expecting %d/n", "cc.Control:registerControlEventHandler", argc, 2); return 0;#if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_Control_registerControlEventHandler'.",&tolua_err); return 0;#endif}
开发者ID:120910383,项目名称:cocos2dx,代码行数:55,
示例4: tolua_ShowWaitingLayerstatic int tolua_ShowWaitingLayer(lua_State *tolua_S){#ifndef TOLUA_TXGUI_RELEASE bool bHasBooleanParam = false; bool bHasFloatParam = false; bool bShowRightNow = true; float fHideTimer = 0; tolua_Error tolua_err; if (tolua_isboolean(tolua_S, 1, 0, &tolua_err)) { bHasBooleanParam = true; bShowRightNow = tolua_toboolean(tolua_S, 1, 0); if (tolua_isnumber(tolua_S, 2, 0, &tolua_err)) { bHasFloatParam = true; fHideTimer = tolua_tonumber(tolua_S, 2, 0); } } int lastIndex = 1; if (bHasBooleanParam) { lastIndex ++; if (bHasFloatParam) { lastIndex++; } } if(!tolua_isnoobj(tolua_S, lastIndex, &tolua_err)) { tolua_error(tolua_S,"#ferror in function 'ShowWaitingLayer'",&tolua_err); return 0; }#endif if (false == bHasBooleanParam) { ShowWaitingLayer(); } else { if (false == bHasFloatParam) { ShowWaitingLayer(bShowRightNow); } else { ShowWaitingLayer(bShowRightNow,fHideTimer); } } return 0;}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:54,
示例5: tolua_ship_set_coaststatic int tolua_ship_set_coast(lua_State * L){ ship *self = (ship *)tolua_tousertype(L, 1, 0); if (lua_isnil(L, 2)) { self->coast = NODIRECTION; } else if (lua_isnumber(L, 2)) { self->coast = (direction_t)tolua_tonumber(L, 2, 0); } return 0;}
开发者ID:Xolgrim,项目名称:server,代码行数:11,
示例6: tolua_set_wyDevice_scaledDensitystatic int tolua_set_wyDevice_scaledDensity(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif wyDevice::scaledDensity = ((float) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:AllenChanAncA,项目名称:WiEngine,代码行数:11,
示例7: tolua_set_wyDevice_realHeightstatic int tolua_set_wyDevice_realHeight(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif wyDevice::realHeight = ((int) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:AllenChanAncA,项目名称:WiEngine,代码行数:11,
示例8: tolua_cocos2dx_Controller_getKeyStatusstatic int tolua_cocos2dx_Controller_getKeyStatus(lua_State* tolua_S){ if (nullptr == tolua_S) return 0; int argc = 0; cocos2d::Controller* self = nullptr;#if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; if (!tolua_isusertype(tolua_S, 1, "cc.Controller", 0, &tolua_err)) goto tolua_lerror;#endif self = static_cast<cocos2d::Controller*>(tolua_tousertype(tolua_S,1,0));#if COCOS2D_DEBUG >= 1 if (nullptr == self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_Controller_getKeyStatus'/n", nullptr); return 0; }#endif argc = lua_gettop(tolua_S) - 1; if (argc == 1) {#if COCOS2D_DEBUG >= 1 if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err)) goto tolua_lerror;#endif int keyCode = (int)tolua_tonumber(tolua_S, 2, 0); cocos2d::Controller::KeyStatus keyStatus = self->getKeyStatus(keyCode); lua_newtable(tolua_S); /* L: table */ lua_pushstring(tolua_S, "isPressed"); /* L: table key */ lua_pushboolean(tolua_S, (int)keyStatus.isPressed); /* L: table key value*/ lua_rawset(tolua_S, -3); /* table[key] = value, L: table */ lua_pushstring(tolua_S, "value"); /* L: table key */ lua_pushnumber(tolua_S, (lua_Number) keyStatus.value); /* L: table key value*/ lua_rawset(tolua_S, -3); /* table[key] = value, L: table */ lua_pushstring(tolua_S, "isAnalog"); /* L: table key */ lua_pushnumber(tolua_S, (int) keyStatus.isAnalog); /* L: table key value*/ lua_rawset(tolua_S, -3); /* table[key] = value, L: table */ return 1; } CCLOG("'clone' has wrong number of arguments: %d, was expecting %d/n", argc, 0); return 0; #if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'getKeyStatus'.",&tolua_err); return 0;#endif}
开发者ID:AceKillerZc,项目名称:ChinaGameWorld,代码行数:54,
示例9: GetStackValuevoid cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal){ if (!lua_isnumber(m_LuaState, a_StackPos)) { return; } a_ReturnedVal = static_cast<eWeather>(Clamp( static_cast<int>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal)), static_cast<int>(wSunny), static_cast<int>(wThunderstorm)) );}
开发者ID:DjKiDD,项目名称:MCServer,代码行数:11,
示例10: tolua_set_FADEUTILITYPARAMS_EndFadeAmountstatic int tolua_set_FADEUTILITYPARAMS_EndFadeAmount (lua_State* tolua_S) { FADEUTILITYPARAMS*self = (FADEUTILITYPARAMS*) tolua_tousertype(tolua_S,1,0);#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'EndFadeAmount'",NULL);#endif#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif self->EndFadeAmount=(( float) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:11,
示例11: tolua_region_get_nextstatic int tolua_region_get_next(lua_State * L){ region *self = (region *)tolua_tousertype(L, 1, 0); direction_t dir = (direction_t)tolua_tonumber(L, 2, 0); if (dir >= 0 && dir < MAXDIRECTIONS) { tolua_pushusertype(L, (void *)r_connect(self, dir), TOLUA_CAST "region"); return 1; } return 0;}
开发者ID:stm2,项目名称:server,代码行数:11,
示例12: tolua_set_ADDDECALSPRITEMESSAGE_m_Sizestatic int tolua_set_ADDDECALSPRITEMESSAGE_m_Size (lua_State* tolua_S) { ADDDECALSPRITEMESSAGE*self = (ADDDECALSPRITEMESSAGE*) tolua_tousertype(tolua_S,1,0);#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_Size'",NULL);#endif#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif self->m_Size=(( float) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:12,
示例13: tolua_region_set_flagstatic int tolua_region_set_flag(lua_State * L){ region *self = (region *)tolua_tousertype(L, 1, 0); int bit = (int)tolua_tonumber(L, 2, 0); int set = tolua_toboolean(L, 3, 1); if (set) self->flags |= (1 << bit); else self->flags &= ~(1 << bit); return 0;}
开发者ID:stm2,项目名称:server,代码行数:12,
示例14: lua_ftk_text_view_insert_textstatic int lua_ftk_text_view_insert_text(lua_State* L){ tolua_Error err = {0}; Ret retv; FtkWidget* thiz; int pos; const char* text; int len; int param_ok = tolua_isusertype(L, 1, "FtkWidget", 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isstring(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err); return_val_if_fail(param_ok, 0); thiz = tolua_tousertype(L, 1, 0); pos = tolua_tonumber(L, 2, 0); text = tolua_tostring(L, 3, 0); len = tolua_tonumber(L, 4, 0); retv = ftk_text_view_insert_text(thiz, pos, text, len); tolua_pushnumber(L, (lua_Number)retv); return 1;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:21,
示例15: HasVarList /// /// 检查当前脚本运行实例是否有某个脚本列表 /// /// ret = HasVarList( operType ) /// @param operType: VT_SCRIPT脚本本身,只在技能脚本里有效; /// VT_SRCSHAPE源对象;VT_DESTSHAPE目标对象; /// VT_GLOBAL全局变量 /// @return 1表示存在 /// static int HasVarList( lua_State *L ) { Script *script = GetInst( ScriptSys ).GetScript( L ); int ret = 1; long operType = (long) tolua_tonumber( L, 1, 0 ); if( script == NULL || script->GetVarList( operType ) == NULL ) { ret = 0; } lua_pushboolean( L, ret ); return 1; }
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:21,
示例16: GetStackValuebool cLuaState::GetStackValue(int a_StackPos, eBlockFace & a_ReturnedVal){ if (!lua_isnumber(m_LuaState, a_StackPos)) { return false; } a_ReturnedVal = static_cast<eBlockFace>(Clamp( static_cast<int>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal)), static_cast<int>(BLOCK_FACE_MIN), static_cast<int>(BLOCK_FACE_MAX)) ); return true;}
开发者ID:1285done,项目名称:cuberite,代码行数:12,
示例17: tolua_set_Point_y/* set function: y of class Point */static int tolua_set_Point_y(lua_State* tolua_S){ Point* self = (Point*) tolua_tousertype(tolua_S,1,0);#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif self->y = ((float) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:ConnorShore,项目名称:Game,代码行数:13,
示例18: tolua_toQVariant// QVariantQVariant tolua_toQVariant(lua_State* L, int lo, void* def) { if (lua_gettop(L) < abs(lo)) { return QVariant(); }; int type = lua_type(L, lo); switch (type) { case LUA_TNIL: return QVariant(); case LUA_TSTRING: return QVariant(tolua_tostring(L, lo, 0)); case LUA_TBOOLEAN: return QVariant(tolua_toboolean(L, lo, 0)==0?false:true); case LUA_TNUMBER: return QVariant(tolua_tonumber(L, lo, 0)); case LUA_TUSERDATA: tolua_Error err; if (tolua_isusertype(L, lo, "QVariant", (int)def, &err)) { return (QVariant)*(QVariant*)tolua_tousertype(L, -1, def); }; lua_pushstring(L, ".QVariant"); lua_gettable(L, lo); if (lua_isfunction(L, -1)) { lua_pushvalue(L, lo); lua_call(L, 1, 1); if (tolua_isusertype(L, lua_gettop(L), "QVariant", 0, &err)) { QVariant ret(*((QVariant*)tolua_tousertype(L, -1, def))); lua_pop(L, 1); return ret; }; }; /* fallthrough */ default: ; // wtf? }; return QVariant();};
开发者ID:BackupTheBerlios,项目名称:luaqt-svn,代码行数:53,
示例19: tolua_cocos2d_control_unregisterControlEventHandlerstatic int tolua_cocos2d_control_unregisterControlEventHandler(lua_State* tolua_S){ if (NULL == tolua_S) return 0; int argc = 0; Control* self = nullptr; #ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!tolua_isusertype(tolua_S,1,"cc.Control",0,&tolua_err)) goto tolua_lerror;#endif self = static_cast<Control*>(tolua_tousertype(tolua_S,1,0)); #ifndef TOLUA_RELEASE if (nullptr == self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_control_unregisterControlEventHandler'/n", NULL); return 0; }#endif argc = lua_gettop(tolua_S) - 1; if (1 == argc) {#ifndef TOLUA_RELEASE if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err)) goto tolua_lerror;#endif int controlevent = (int)tolua_tonumber(tolua_S,2,0); for (int i = 0; i < kControlEventTotalNumber; i++) { if ((controlevent & (1 << i))) { ScriptHandlerMgr::HandlerType handlerevent = ScriptHandlerMgr::HandlerType((int)ScriptHandlerMgr::HandlerType::CONTROL_TOUCH_DOWN + i); ScriptHandlerMgr::getInstance()->removeObjectHandler((void*)self, handlerevent); break; } } return 0; } luaL_error(tolua_S, "%s function of Control has wrong number of arguments: %d, was expecting %d/n", "cc.Control:unregisterControlEventHandler", argc, 1); return 0; #ifndef TOLUA_RELEASEtolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_control_unregisterControlEventHandler'.",&tolua_err); return 0;#endif}
开发者ID:ourgames,项目名称:dc208,代码行数:52,
示例20: tolua_set_tarray_Array_a/* set function: a of class Array */static int tolua_set_tarray_Array_a(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->a[tolua_index] = ((int) tolua_tonumber(tolua_S,3,0)); return 0;}
开发者ID:ConnorShore,项目名称:Game,代码行数:23,
示例21: tolua_faction_set_idstatic int tolua_faction_set_id(lua_State * L){ faction *self = (faction *)tolua_tousertype(L, 1, 0); int id = (int)tolua_tonumber(L, 2, 0); if (findfaction(id) == NULL) { renumber_faction(self, id); lua_pushboolean(L, 1); } else { lua_pushboolean(L, 0); } return 1;}
开发者ID:Xolgrim,项目名称:server,代码行数:13,
示例22: lua_register_sls_world_getGeoint lua_register_sls_world_getGeo(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 == 2) { tolua_Error tolua_err; if (tolua_isnumber(tolua_S,2,0,&tolua_err) && tolua_isnumber(tolua_S,3,0,&tolua_err)) { int w = tolua_tonumber(tolua_S, 2, 0); int h = tolua_tonumber(tolua_S, 3, 0); sls::Geo* ret = &(cobj->getGeo(w, h)); tolua_pushusertype(tolua_S,(void*)ret,"sls.Geo"); return 1; } } return 0;}
开发者ID:grayfire,项目名称:SlothEvolution,代码行数:22,
示例23: tolua_set_region_moneystatic int tolua_set_region_money(lua_State* tolua_S){ region* self = (region*) tolua_tousertype(tolua_S,1,0);#ifndef TOLUA_RELEASE tolua_Error tolua_err; if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'money'",NULL); if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);#endif self->money = ((int) tolua_tonumber(tolua_S,2,0)); return 0;}
开发者ID:ennorehling,项目名称:atlantis,代码行数:13,
示例24: tolua_Cocos2dx_CCTableView_registerScriptHandlerstatic int tolua_Cocos2dx_CCTableView_registerScriptHandler(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCTableView",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 { CCTableView* self = (CCTableView*) 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()) { LUA_TableViewDelegate* delegate = new LUA_TableViewDelegate(); if (NULL == delegate) return 0; CCDictionary* userDict = static_cast<CCDictionary*>(self->getUserObject()); if (NULL == userDict) { userDict = new CCDictionary(); if (NULL == userDict) return 0; self->setUserObject(userDict); userDict->release(); } userDict->setObject(delegate, KEY_TABLEVIEW_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_RELEASEtolua_lerror: tolua_error(tolua_S,"#ferror in function 'registerScriptHandler'.",&tolua_err); return 0;#endif}
开发者ID:13609594236,项目名称:quick-cocos2d-x,代码行数:51,
示例25: lua_ftk_text_view_createstatic 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;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:23,
示例26: tolua_storage_writestatic int tolua_storage_write(lua_State * L){ gamedata *data = (gamedata *)tolua_tousertype(L, 1, 0); if (data->version && tolua_isnumber(L, 2, 0, 0)) { lua_Number num = tolua_tonumber(L, 2, 0); double n; if (modf(num, &n) == 0.0) { WRITE_INT(data->store, (int)num); } else { WRITE_FLT(data->store, (float)num); } } return 0;}
开发者ID:UweKopf,项目名称:server,代码行数:14,
示例27: tolua_CCGLProgram_CCGLProgram_setUniformLocationWith4f00static int tolua_CCGLProgram_CCGLProgram_setUniformLocationWith4f00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCGLProgram",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_isnoobj(tolua_S,7,&tolua_err) ) goto tolua_lerror; else#endif { CCGLProgram* self = (CCGLProgram*) tolua_tousertype(tolua_S,1,0); int location = ((int) tolua_tonumber(tolua_S,2,0)); float f1 = ((float) tolua_tonumber(tolua_S,3,0)); float f2 = ((float) tolua_tonumber(tolua_S,4,0)); float f3 = ((float) tolua_tonumber(tolua_S,5,0)); float f4 = ((float) tolua_tonumber(tolua_S,6,0));#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setUniformLocationWith4f'", NULL);#endif { self->setUniformLocationWith4f(location,f1,f2,f3,f4); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'setUniformLocationWith4f'.",&tolua_err); return 0;#endif}
开发者ID:imuzi,项目名称:MyApp,代码行数:37,
示例28: tolua_cocos2d_CCBProxy_setCallbackstatic int tolua_cocos2d_CCBProxy_setCallback(lua_State* tolua_S){ if (nullptr == tolua_S) return 0; int argc = 0; CCBProxy* self = nullptr; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; if (!tolua_isusertype(tolua_S,1,"cc.CCBProxy",0,&tolua_err)) goto tolua_lerror;#endif self = static_cast<CCBProxy*>(tolua_tousertype(tolua_S,1,0));#if COCOS2D_DEBUG >= 1 if (nullptr == self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_CCBProxy_setCallback'/n", NULL); return 0; }#endif argc = lua_gettop(tolua_S) - 1; if ( argc >= 2 && argc <= 3 ) {#if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,2,"cc.Node",0,&tolua_err) || !toluafix_isfunction(tolua_S, 3, "LUA_FUNCTION", 0, &tolua_err) || !tolua_isnumber(tolua_S, 4, 1, &tolua_err) ) goto tolua_lerror;#endif Node* node = ((Node*)tolua_tousertype(tolua_S,2,0)); LUA_FUNCTION funID = ( toluafix_ref_function(tolua_S,3,0)); int controlEvents = (int)tolua_tonumber(tolua_S, 4, 1); self->setCallback(node, funID, controlEvents); return 0; } CCLOG(" %s has wrong number of arguments: %d, was expecting %d/n", "cc.CCBProxy:setCallback", argc, 2); return 0; #if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_CCBProxy_setCallback'.",&tolua_err); return 0;#endif}
开发者ID:AnySDK,项目名称:Sample_Lua,代码行数:49,
注:本文中的tolua_tonumber函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tolua_tostring函数代码示例 C++ tolua_toboolean函数代码示例 |