int lua_cocos2dx_spine_Skeleton_onDraw(lua_State* tolua_S) { int argc = 0; spine::Skeleton* cobj = nullptr; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"sp.Skeleton",0,&tolua_err)) goto tolua_lerror; #endif cobj = (spine::Skeleton*)tolua_tousertype(tolua_S,1,0); #if COCOS2D_DEBUG >= 1 if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_spine_Skeleton_onDraw'", nullptr); return 0; } #endif argc = lua_gettop(tolua_S)-1; if (argc == 2) { cocos2d::Mat4 arg0; unsigned int arg1; ok &= luaval_to_mat4(tolua_S, 2, &arg0, "sp.Skeleton:onDraw"); ok &= luaval_to_uint32(tolua_S, 3,&arg1, "sp.Skeleton:onDraw"); if(!ok) return 0; cobj->onDraw(arg0, arg1); return 0; } CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "sp.Skeleton:onDraw",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_spine_Skeleton_onDraw'.",&tolua_err); #endif return 0; }
int 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 >= 1 tolua_lerror: tolua_error(L,"#ferror in function 'lua_cocos2dx_physics3d_Physics3DShape_createCompoundShape'.",&tolua_err); #endif return 0; }
bool 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; }