这篇教程C++ tolua_istable函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tolua_istable函数的典型用法代码示例。如果您正苦于以下问题:C++ tolua_istable函数的具体用法?C++ tolua_istable怎么用?C++ tolua_istable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tolua_istable函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: TOLUA_API int tolua_isusertypearray (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err){ if (!tolua_istable(L,lo,def,err)) return 0; else { int i; if (dim == -1) // Urho3D - auto detect the array size if -1 is given dim = (int)lua_objlen(L, lo); for (i=1; i<=dim; ++i) { lua_pushnumber(L,i); lua_gettable(L,lo); if (!(lua_isnil(L,-1) || lua_isusertype(L,-1, type)) && // Urho3D - bug fix to check user type instead of user data !(def && lua_isnil(L,-1)) ) { err->index = lo; err->type = type; err->array = 1; return 0; } lua_pop(L,1); } } return 1;}
开发者ID:KunKua,项目名称:Urho3D,代码行数:28,
示例2: TOLUA_API int tolua_isusertypearray(lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err){ if (!tolua_istable(L,lo,def,err)) return 0; else { int i; for (i=1; i<=dim; ++i) { lua_pushnumber(L,i); lua_gettable(L,lo); if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && !(def && lua_isnil(L,-1)) ) { err->index = lo; err->type = type; err->array = 1; return 0; } lua_pop(L,1); } } return 1;}
开发者ID:r8d8,项目名称:Urho3D,代码行数:26,
示例3: luaval_to_tdga_mapbool luaval_to_tdga_map(lua_State* L,int lo,EventParamMap* outValue){ if (NULL == L || NULL == outValue) return false; bool ok = true; tolua_Error tolua_err; if (!tolua_istable(L,lo,0,&tolua_err)) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err);#endif ok = false; } if (ok) { lua_pushnil(L); while (lua_next(L, lo)) { lua_pushvalue(L, -2); const char* key = lua_tostring(L, -1); const char* value = lua_tostring(L, -2); (*outValue).insert(EventParamPair(key, value)); lua_pop(L, 2); } } return ok;}
开发者ID:beijixing,项目名称:game-analytics-cocos2dx,代码行数:30,
示例4: luaval_to_std_map_string_stringbool luaval_to_std_map_string_string(lua_State* L, int lo, std::map<std::string, std::string>* ret, const char* funcName) { if (nullptr == L || nullptr == ret || lua_gettop(L) < lo) return false; tolua_Error tolua_err; bool ok = true; if (!tolua_istable(L, lo, 0, &tolua_err)) { ok = false; } if (!ok) return ok; lua_pushnil(L); std::string key; std::string value; while (lua_next(L, lo) != 0) { if (lua_isstring(L, -2) && lua_isstring(L, -1)) { if (luaval_to_std_string(L, -2, &key) && luaval_to_std_string(L, -1, &value)) { (*ret)[key] = value; } } else { //CCASSERT(false, "string type is needed"); } lua_pop(L, 1); } return ok;}
开发者ID:tinybearc,项目名称:sdkbox-sample-adcolony,代码行数:30,
示例5: ASSERTbool cLuaState::CheckParamTable(int a_StartParam, int a_EndParam){ ASSERT(IsValid()); if (a_EndParam < 0) { a_EndParam = a_StartParam; } tolua_Error tolua_err; for (int i = a_StartParam; i <= a_EndParam; i++) { if (tolua_istable(m_LuaState, i, 0, &tolua_err)) { continue; } // Not the correct parameter lua_Debug entry; VERIFY(lua_getstack(m_LuaState, 0, &entry)); VERIFY(lua_getinfo (m_LuaState, "n", &entry)); AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); return false; } // for i - Param // All params checked ok return true;}
开发者ID:ravenscroftj,项目名称:MCServer,代码行数:28,
示例6: luaval_to_Physics3DWorld_HitResultbool luaval_to_Physics3DWorld_HitResult(lua_State* L,int lo, cocos2d::Physics3DWorld::HitResult* outValue, const char* funcName){ if (nullptr == L || nullptr == outValue) return false; bool ok = true; tolua_Error tolua_err; if (!tolua_istable(L, lo, 0, &tolua_err) ) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);#endif ok = false; } if (ok) { lua_pushstring(L, "hitPosition"); lua_gettable(L, lo); if (!lua_istable(L, -1)) { outValue->hitPosition = cocos2d::Vec3(); } else { luaval_to_vec3(L, lua_gettop(L), &(outValue->hitPosition)); } lua_pop(L, 1); lua_pushstring(L, "hitNormal"); lua_gettable(L, lo); if (!lua_istable(L, -1)) { outValue->hitNormal = cocos2d::Vec3(); } else { luaval_to_vec3(L, lua_gettop(L), &(outValue->hitNormal)); } lua_pop(L, 1); lua_pushstring(L, "hitObj"); lua_gettable(L, lo); if (!tolua_isusertype(L, -1, "cc.Physics3DObject", 0, &tolua_err)) { outValue->hitObj = nullptr; } else { outValue->hitObj = static_cast<cocos2d::Physics3DObject*>(tolua_tousertype(L, lua_gettop(L), nullptr)); } lua_pop(L, 1); } return true;}
开发者ID:2016Go,项目名称:TF2016-NEW,代码行数:56,
示例7: tolua_glu_gluPickMatrix00static int tolua_glu_gluPickMatrix00(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_istable(tolua_S,5,0,&tolua_err) || !tolua_isnoobj(tolua_S,6,&tolua_err) ) goto tolua_lerror; else#endif { double x = (( double) tolua_tonumber(tolua_S,1,0)); double y = (( double) tolua_tonumber(tolua_S,2,0)); double width = (( double) tolua_tonumber(tolua_S,3,0)); double height = (( double) tolua_tonumber(tolua_S,4,0)); int viewport[4]; {#ifndef TOLUA_RELEASE if (!tolua_isnumberarray(tolua_S,5,4,0,&tolua_err)) goto tolua_lerror; else#endif { int i; for(i=0; i<4;i++) viewport[i] = ((int) tolua_tofieldnumber(tolua_S,5,i+1,0)); } } { gluPickMatrix(x,y,width,height,viewport); } { int i; for(i=0; i<4;i++) tolua_pushfieldnumber(tolua_S,5,i+1,(lua_Number) viewport[i]); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'gluPickMatrix'.",&tolua_err); return 0;#endif}
开发者ID:mmahnic,项目名称:cogx-display-server,代码行数:49,
示例8: lua_ftk_initstatic int lua_ftk_init(lua_State* L){ tolua_Error err = {0}; Ret retv; int argc; char** argv; int param_ok = tolua_isnumber(L, 1, 0, &err) && tolua_istable(L, 2, 0, &err); return_val_if_fail(param_ok, 0); argc = tolua_tonumber(L, 1, 0); argv = (char**)tolua_tostrings(L, 2, 0); retv = ftk_init(argc, argv); tolua_pushnumber(L, (lua_Number)retv); free(argv); return 1;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:18,
示例9: lua_ftk_infomationstatic int lua_ftk_infomation(lua_State* L){ tolua_Error err = {0}; int retv; const char* title; const char* text; const char** buttons; int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_istable(L, 3, 0, &err); return_val_if_fail(param_ok, 0); title = tolua_tostring(L, 1, 0); text = tolua_tostring(L, 2, 0); buttons = tolua_tostrings(L, 3, 0); retv = ftk_infomation(title, text, buttons); tolua_pushnumber(L, (lua_Number)retv); free(buttons); return 1;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:20,
示例10: luaval_to_offmeshlinkdatabool luaval_to_offmeshlinkdata(lua_State* L, int lo, cocos2d::OffMeshLinkData* outValue , const char* funcName){ if (nullptr == L || nullptr == outValue) return false; bool ok = true; tolua_Error tolua_err; if (!tolua_istable(L, lo, 0, &tolua_err) ) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);#endif ok = false; } if (ok) { lua_pushstring(L, "startPosition"); lua_gettable(L,lo); ok &= luaval_to_vec3(L, lua_gettop(L), &outValue->startPosition); if(!ok) { lua_pop(L, 1); return false; } lua_pop(L,1); lua_pushstring(L, "endPosition"); ok &= luaval_to_vec3(L, lua_gettop(L), &outValue->endPosition); if(!ok) { lua_pop(L, 1); return false; } lua_pop(L,1); return true; } return false;}
开发者ID:FenneX,项目名称:FenneXEmptyProject,代码行数:41,
示例11: luaval_to_std_vector_stringbool luaval_to_std_vector_string(lua_State* L, int lo, std::vector<std::string>* ret, const char* funcName){ if (NULL == L || NULL == ret || lua_gettop(L) < lo) return false; tolua_Error tolua_err; bool ok = true; if (!tolua_istable(L, lo, 0, &tolua_err)) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);#endif ok = false; } if (ok) { size_t len = lua_objlen(L, lo); std::string value = ""; for (size_t i = 0; i < len; i++) { lua_pushnumber(L, i + 1); lua_gettable(L,lo); if(lua_isstring(L, -1)) { ok = luaval_to_std_string(L, -1, &value); if(ok) ret->push_back(value); } else { // CCASSERT(false, "string type is needed"); } lua_pop(L, 1); } } return ok;}
开发者ID:tinybearc,项目名称:sdkbox-sample-adcolony,代码行数:40,
示例12: toluafix_istableTOLUA_API int toluafix_istable(lua_State* L, int lo, const char* type, int def, tolua_Error* err){ return tolua_istable(L, lo, def, err);}
开发者ID:joewan,项目名称:cocos2d-x,代码行数:4,
示例13: lua_cocos2dx_DrawNode3D_drawCubeint lua_cocos2dx_DrawNode3D_drawCube(lua_State* L){ int argc = 0; cocos2d::DrawNode3D* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err;#endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(L,1,"cc.DrawNode3D",0,&tolua_err)) goto tolua_lerror;#endif cobj = (cocos2d::DrawNode3D*)tolua_tousertype(L,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(L,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode3D_drawCube'", nullptr); return 0; }#endif argc = lua_gettop(L)-1; if (argc == 2) { std::vector<cocos2d::Vec3> arg0; cocos2d::Color4F arg1; Vec3 vec3;#if COCOS2D_DEBUG >= 1 if (!tolua_istable(L, 2, 0, &tolua_err)) goto tolua_lerror;#endif size_t size = lua_objlen(L, 2); for (int i = 0; i < size; i++) { lua_pushnumber(L, i + 1); lua_gettable(L, 2);#if COCOS2D_DEBUG >= 1 if (!tolua_istable(L, -1, 0, &tolua_err)) { lua_pop(L, 1); goto tolua_lerror; }#endif ok &= luaval_to_vec3(L, lua_gettop(L), &vec3); #if COCOS2D_DEBUG >= 1 if (!ok) { lua_pop(L, 1); goto tolua_lerror; }#endif //arg0[i] = vec3; arg0.push_back(vec3); lua_pop(L, 1); } ok &=luaval_to_color4f(L, 3, &arg1, "cc.DrawNode3D:drawCube"); if(!ok) return 0; cobj->drawCube(&arg0[0], arg1); return 0; } CCLOG("%s has wrong number of arguments: %d, was expecting %d /n", "cc.DrawNode3D:drawCube",argc, 2); return 0; #if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(L,"#ferror in function 'lua_cocos2dx_DrawNode3D_drawCube'.",&tolua_err);#endif return 0;}
开发者ID:AomXD,项目名称:workspace,代码行数:77,
示例14: lua_cocos2dx_physics3d_Physics3DShape_createCompoundShapeint lua_cocos2dx_physics3d_Physics3DShape_createCompoundShape(lua_State* L){ int argc = 0; bool ok = true; tolua_Error tolua_err; #if COCOS2D_DEBUG >= 1 if (!tolua_isusertable(L,1,"cc.Physics3DShape",0,&tolua_err)) goto tolua_lerror;#endif argc = lua_gettop(L) - 1; if (argc == 1) { std::vector<std::pair<cocos2d::Physics3DShape *, cocos2d::Mat4>> shapes; if (!tolua_istable(L, 2, 0, &tolua_err) ) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err,"cc.Physics3DShape:createCompoundShape");#endif ok = false; } if (ok) { size_t len = lua_objlen(L, 2); cocos2d::Physics3DShape* shape = nullptr; cocos2d::Mat4 mat; for (size_t i = 0; i < len; i++) { lua_pushnumber(L,i + 1); lua_gettable(L,2); if (lua_istable(L, -1)) { lua_pushnumber(L, 1); lua_gettable(L, -2); luaval_to_object(L, lua_gettop(L), "cc.Physics3DShape", &shape); lua_pop(L,1); lua_pushnumber(L, 2); lua_gettable(L, -2); luaval_to_mat4(L, lua_gettop(L), &mat); lua_pop(L,1); shapes.push_back(std::make_pair(shape, mat)); } lua_pop(L, 1); } } cocos2d::Physics3DShape* ret = cocos2d::Physics3DShape::createCompoundShape(shapes); object_to_luaval<cocos2d::Physics3DShape>(L, "cc.Physics3DShape",(cocos2d::Physics3DShape*)ret); return 1; } luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d/n ", "cc.Physics3DShape:createCompoundShape",argc, 1); return 0;#if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(L,"#ferror in function 'lua_cocos2dx_physics3d_Physics3DShape_createCompoundShape'.",&tolua_err);#endif return 0;}
开发者ID:2016Go,项目名称:TF2016-NEW,代码行数:64,
示例15: luatable_to_map_string_stringbool luatable_to_map_string_string(lua_State* L, int lo, std::map<std::string,std::string>* ret, const char* funcName){ if ( nullptr == L || nullptr == ret) return false; tolua_Error tolua_err; bool ok = true; if (!tolua_istable(L, lo, 0, &tolua_err)) { ok = false; } if (ok) { std::string stringKey = ""; std::string stringValue = ""; bool boolVal = false; std::map<std::string,std::string>& dict = *ret; lua_pushnil(L); /* first key L: lotable ..... nil */ while ( 0 != lua_next(L, lo ) ) /* L: lotable ..... key value */ { if (!lua_isstring(L, -2)) { lua_pop(L, 1); /* removes 'value'; keep 'key' for next iteration*/ continue; } if(luaval_to_std_string(L, -2, &stringKey)) { if(lua_istable(L, -1)) { // skip nested objects } else if(lua_type(L, -1) == LUA_TSTRING) { if(luaval_to_std_string(L, -1, &stringValue)) { dict[stringKey] = stringValue; } } else if(lua_type(L, -1) == LUA_TBOOLEAN) { if (luaval_to_boolean(L, -1, &boolVal)) { dict[stringKey] = boolVal ? "true" : "false"; } } else if(lua_type(L, -1) == LUA_TNUMBER) { char c[80]; snprintf( c, sizeof(c), "%f",tolua_tonumber(L, -1, 0) ); dict[stringKey] = std::string(c) ; } } lua_pop(L, 1); /* L: lotable ..... key */ } } return ok;}
开发者ID:hpcplus2,项目名称:sdkbox-iap-sample,代码行数:62,
示例16: luaval_to_navmeshagentparambool luaval_to_navmeshagentparam(lua_State* L, int lo, cocos2d::NavMeshAgentParam* outValue , const char* funcName){ if (nullptr == L || nullptr == outValue) return false; bool ok = true; tolua_Error tolua_err; if (!tolua_istable(L, lo, 0, &tolua_err) ) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);#endif ok = false; } if (ok) { lua_pushstring(L, "radius"); lua_gettable(L,lo); outValue->radius = lua_isnumber(L, -1)? (float)lua_tonumber(L, -1) : 0.6; lua_pop(L,1); lua_pushstring(L, "height"); lua_gettable(L,lo); outValue->height = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 2.0; lua_pop(L,1); lua_pushstring(L, "maxAcceleration"); lua_gettable(L, lo); outValue->maxAcceleration = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 8.0; lua_pop(L, 1); lua_pushstring(L, "maxSpeed"); lua_gettable(L, lo); outValue->maxSpeed = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 3.5; lua_pop(L, 1); lua_pushstring(L, "collisionQueryRange"); lua_gettable(L, lo); outValue->collisionQueryRange = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : outValue->radius * 12.0; lua_pop(L, 1); lua_pushstring(L, "pathOptimizationRange"); lua_gettable(L, lo); outValue->pathOptimizationRange = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : outValue->radius * 30.0; lua_pop(L, 1); lua_pushstring(L, "separationWeight"); lua_gettable(L, lo); outValue->separationWeight = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 2.0; lua_pop(L, 1); lua_pushstring(L, "updateFlags"); lua_gettable(L, lo); outValue->updateFlags = lua_isnumber(L, -1)?(unsigned char)lua_tonumber(L, -1) : DT_CROWD_ANTICIPATE_TURNS | DT_CROWD_OPTIMIZE_VIS | DT_CROWD_OPTIMIZE_TOPO | DT_CROWD_OBSTACLE_AVOIDANCE; lua_pop(L, 1); lua_pushstring(L, "obstacleAvoidanceType"); lua_gettable(L, lo); outValue->obstacleAvoidanceType = lua_isnumber(L, -1)?(unsigned char)lua_tonumber(L, -1) : 3; lua_pop(L, 1); lua_pushstring(L, "queryFilterType"); lua_gettable(L, lo); outValue->queryFilterType = lua_isnumber(L, -1)?(unsigned char)lua_tonumber(L, -1) : 0; lua_pop(L, 1); return true; } return false;}
开发者ID:FenneX,项目名称:FenneXEmptyProject,代码行数:74,
示例17: tolua_cocos2dx_NVGDrawNode_drawPointsint tolua_cocos2dx_NVGDrawNode_drawPoints(lua_State* tolua_S){ int argc = 0; cocos2d::extension::NVGDrawNode* self = nullptr; bool ok = true; tolua_Error tolua_err;#if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.NVGDrawNode",0,&tolua_err)) goto tolua_lerror;#endif self = (cocos2d::extension::NVGDrawNode*)tolua_tousertype(tolua_S,1,0);#if COCOS2D_DEBUG >= 1 if (!self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_NVGDrawNode_drawPoints'", nullptr); return 0; }#endif argc = lua_gettop(tolua_S)-1; if (argc == 3) { unsigned int size; luaval_to_uint32(tolua_S, 3, &size, "cc.NVGDrawNode:drawPoints"); 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:drawPoints")) { lua_pop(tolua_S, 1); CC_SAFE_DELETE_ARRAY(points); return 0; } lua_pop(tolua_S, 1); } cocos2d::Color4F arg2; ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.NVGDrawNode:drawPoints"); if(!ok) return 0; self->drawPoints(points, size, arg2); return 0; } } CCLOG("%s has wrong number of arguments: %d, was expecting %d /n", "cc.NVGDrawNode:drawPoints",argc, 3); return 0;#if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_NVGDrawNode_drawPoints'.",&tolua_err);#endif return 0;}
开发者ID:coderScum,项目名称:Quick-Cocos2dx-Community,代码行数:74,
示例18: tolua_cocos2dx_NVGDrawNode_setPointsstatic 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 >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_NVGDrawNode_setPoints'.",&tolua_err); return 0;#endif}
开发者ID:coderScum,项目名称:Quick-Cocos2dx-Community,代码行数:75,
示例19: tolua_cocos2dx_AttackArea_drawPolygonint tolua_cocos2dx_AttackArea_drawPolygon(lua_State* tolua_S){ if (NULL == tolua_S) return 0; int argc = 0; AttackArea* self = nullptr; bool ok = true; 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 (!self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2dx_AttackArea_drawPolygon'", NULL); return 0; }#endif argc = lua_gettop(tolua_S)-1; if (argc == 4) { unsigned int size; luaval_to_uint32(tolua_S, 3, &size, "AttackArea:drawPolygon"); 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:drawPolygon")) { lua_pop(tolua_S, 1); CC_SAFE_DELETE_ARRAY(points); return 0; } lua_pop(tolua_S, 1); } bool arg2; cocos2d::Color4F arg3; ok &= luaval_to_boolean(tolua_S, 4,&arg2, "AttackArea:drawPolygon"); ok &= luaval_to_color4f(tolua_S, 5, &arg3, "AttackArea:drawPolygon"); if(!ok) return 0; self->drawPolygon(points, size, arg2, arg3); CC_SAFE_DELETE_ARRAY(points); return 0; } } CCLOG("%s has wrong number of arguments: %d, was expecting %d /n", "AttackArea:drawPolygon",argc, 4); return 0; #if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2dx_AttackArea_drawPolygon'.",&tolua_err);#endif return 0;}
开发者ID:heruohuan,项目名称:hebiTest,代码行数:82,
示例20: tolua_cocos2dx_AttackArea_drawSolidPolygonstatic 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 >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_DrawNode_drawSolidPolygon'.",&tolua_err); return 0;#endif}
开发者ID:heruohuan,项目名称:hebiTest,代码行数:83,
示例21: tolua_glu_gluUnProject00static 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}
开发者ID:mmahnic,项目名称:cogx-display-server,代码行数:95,
示例22: luaval_to_ccluavaluevectorbool luaval_to_ccluavaluevector(lua_State* L, int lo, LuaValueArray* ret, const char* funcName){ if (nullptr == L || nullptr == ret) return false; tolua_Error tolua_err; bool ok = true; if (!tolua_istable(L, lo, 0, &tolua_err)) {#if COCOS2D_DEBUG >=1 // luaval_to_native_err(L,"#ferror:",&tolua_err);#endif ok = false; } if (ok) { size_t len = lua_objlen(L, lo); for (size_t i = 0; i < len; i++) { lua_pushnumber(L,i + 1); lua_gettable(L,lo); if (lua_isnil(L,-1)) { lua_pop(L, 1); continue; } if(lua_istable(L, -1)) { lua_pushnumber(L,1); lua_gettable(L,-2); if (lua_isnil(L, -1) ) { lua_pop(L,1); LuaValueDict dictVal; if (luaval_to_ccluavaluemap(L, lua_gettop(L), &dictVal)) { ret->push_back(LuaValue::dictValue(dictVal)); } } else { lua_pop(L,1); LuaValueArray arrVal; if(luaval_to_ccluavaluevector(L, lua_gettop(L), &arrVal)) { ret->push_back(LuaValue::arrayValue(arrVal)); } } } else if(lua_type(L, -1) == LUA_TSTRING) { std::string stringValue = ""; if(luaval_to_std_string(L, -1, &stringValue) ) { ret->push_back(LuaValue::stringValue(stringValue)); } } else if(lua_type(L, -1) == LUA_TBOOLEAN) { bool boolVal = false; if (luaval_to_boolean(L, -1, &boolVal)) { ret->push_back(LuaValue::booleanValue(boolVal)); } } else if(lua_type(L, -1) == LUA_TNUMBER) { ret->push_back(LuaValue::floatValue(tolua_tonumber(L, -1, 0))); } else { // CCASSERT(false, "not supported type"); } lua_pop(L, 1); } } return ok;}
开发者ID:tinybearc,项目名称:sdkbox-sample-adcolony,代码行数:81,
示例23: luaval_to_ccluavaluemapbool luaval_to_ccluavaluemap(lua_State* L, int lo, LuaValueDict* ret, const char* funcName){ if ( nullptr == L || nullptr == ret) return false; tolua_Error tolua_err; bool ok = true; if (!tolua_istable(L, lo, 0, &tolua_err)) {#if COCOS2D_DEBUG >=1 // luaval_to_native_err(L,"#ferror:",&tolua_err);#endif ok = false; } if (ok) { std::string stringKey = ""; std::string stringValue = ""; bool boolVal = false; LuaValueDict& dict = *ret; lua_pushnil(L); /* first key L: lotable ..... nil */ while ( 0 != lua_next(L, lo ) ) /* L: lotable ..... key value */ { if (!lua_isstring(L, -2)) { lua_pop(L, 1); /* removes 'value'; keep 'key' for next iteration*/ continue; } if(luaval_to_std_string(L, -2, &stringKey)) { if(lua_istable(L, -1)) { lua_pushnumber(L,1); lua_gettable(L,-2); if (lua_isnil(L, -1) ) /** if table[1] = nil,we don't think it is a pure array */ { lua_pop(L,1); LuaValueDict dictVal; if (luaval_to_ccluavaluemap(L, lua_gettop(L), &dictVal)) { dict[stringKey] = LuaValue::dictValue(dictVal); } } else { lua_pop(L,1); LuaValueArray arrVal; if (luaval_to_ccluavaluevector(L, lua_gettop(L), &arrVal)) { dict[stringKey] = LuaValue::arrayValue(arrVal); } } } else if(lua_type(L, -1) == LUA_TSTRING) { if(luaval_to_std_string(L, -1, &stringValue)) { dict[stringKey] = LuaValue::stringValue(stringValue); } } else if(lua_type(L, -1) == LUA_TBOOLEAN) { if (luaval_to_boolean(L, -1, &boolVal)) { dict[stringKey] = LuaValue::booleanValue(boolVal); } } else if(lua_type(L, -1) == LUA_TNUMBER) { dict[stringKey] = LuaValue::floatValue(tolua_tonumber(L, -1, 0)); } else { // CCASSERT(false, "not supported type"); } } lua_pop(L, 1); /* L: lotable ..... key */ } } return ok;}
开发者ID:tinybearc,项目名称:sdkbox-sample-adcolony,代码行数:87,
示例24: luaval_to_Physics3DRigidBodyDesbool luaval_to_Physics3DRigidBodyDes(lua_State* L,int lo,cocos2d::Physics3DRigidBodyDes* outValue, const char* funcName){ if (nullptr == L || nullptr == outValue) return false; bool ok = true; tolua_Error tolua_err; if (!tolua_istable(L, lo, 0, &tolua_err) ) {#if COCOS2D_DEBUG >=1 luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);#endif ok = false; } if (ok) { lua_pushstring(L, "mass"); lua_gettable(L, lo); outValue->mass = lua_isnil(L, -1) ? 0 : lua_tonumber(L, -1); lua_pop(L, 1); lua_pushstring(L, "localInertia"); lua_gettable(L, lo); if (!lua_istable(L, -1)) { outValue->localInertia = cocos2d::Vec3(0.0, 0.0, 0.0); } else { luaval_to_vec3(L, lua_gettop(L), &outValue->localInertia); } lua_pop(L, 1); lua_pushstring(L, "shape"); lua_gettable(L, lo); if (!tolua_isusertype(L, -1, "cc.Physics3DShape", 0, &tolua_err)) { outValue->shape = nullptr; } else { outValue->shape = static_cast<cocos2d::Physics3DShape*>(tolua_tousertype(L, lua_gettop(L), nullptr)); } lua_pop(L, 1); lua_pushstring(L, "originalTransform"); lua_gettable(L, lo); if (!lua_istable(L, -1)) { outValue->originalTransform = cocos2d::Mat4(); } else { luaval_to_mat4(L, lua_gettop(L), &outValue->originalTransform); } lua_pop(L, 1); lua_pushstring(L, "disableSleep"); lua_gettable(L, lo); outValue->disableSleep = lua_isnil(L, -1) ? false : lua_toboolean(L, -1); lua_pop(L, 1); } return ok;}
开发者ID:2016Go,项目名称:TF2016-NEW,代码行数:66,
示例25: tolua_glu_gluLoadSamplingMatrices00static int tolua_glu_gluLoadSamplingMatrices00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"GLUnurbsObj",0,&tolua_err) || !tolua_istable(tolua_S,2,0,&tolua_err) || !tolua_istable(tolua_S,3,0,&tolua_err) || !tolua_istable(tolua_S,4,0,&tolua_err) || !tolua_isnoobj(tolua_S,5,&tolua_err) ) goto tolua_lerror; else#endif { GLUnurbsObj* nobj = ((GLUnurbsObj*) tolua_tousertype(tolua_S,1,0)); float modelMatrix[16]; float projMatrix[16]; int viewport[4]; {#ifndef TOLUA_RELEASE if (!tolua_isnumberarray(tolua_S,2,16,0,&tolua_err)) goto tolua_lerror; else#endif { int i; for(i=0; i<16;i++) modelMatrix[i] = ((float) tolua_tofieldnumber(tolua_S,2,i+1,0)); } } {#ifndef TOLUA_RELEASE if (!tolua_isnumberarray(tolua_S,3,16,0,&tolua_err)) goto tolua_lerror; else#endif { int i; for(i=0; i<16;i++) projMatrix[i] = ((float) tolua_tofieldnumber(tolua_S,3,i+1,0)); } } {#ifndef TOLUA_RELEASE if (!tolua_isnumberarray(tolua_S,4,4,0,&tolua_err)) goto tolua_lerror; else#endif { int i; for(i=0; i<4;i++) viewport[i] = ((int) tolua_tofieldnumber(tolua_S,4,i+1,0)); } } { gluLoadSamplingMatrices(nobj,modelMatrix,projMatrix,viewport); } { int i; for(i=0; i<16;i++) tolua_pushfieldnumber(tolua_S,2,i+1,(lua_Number) modelMatrix[i]); } { int i; for(i=0; i<16;i++) tolua_pushfieldnumber(tolua_S,3,i+1,(lua_Number) projMatrix[i]); } { int i; for(i=0; i<4;i++) tolua_pushfieldnumber(tolua_S,4,i+1,(lua_Number) viewport[i]); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'gluLoadSamplingMatrices'.",&tolua_err); return 0;#endif}
开发者ID:mmahnic,项目名称:cogx-display-server,代码行数:81,
注:本文中的tolua_istable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tolua_isusertype函数代码示例 C++ tolua_isstring函数代码示例 |