zoukankan      html  css  js  c++  java
  • (转)LuaPlus子表遍历

    简单的配置,先将就用吧,luaplus那由于别人的教材在表循环那里没写清楚,导致浪费了很多时间,最后还是看src才知道。

    ------------------------------------------------------------------------------------------------------

    tabObjectData = {
    [0x00001000] = {
       MeshName = "00040_lian.mesh",
       MeshDIR = "/models/Player/female/",
       ShowName = "女主角1",
       Scale = 0.01,
       Image = "ptgw.tga",
       ImageIndex = 0,
       EffectList = {
        [0x00000001] = {
         BindBone = "",
         OffestPos = { x = 0.0, y = 0.0, z= 0.0 },
         Direction = { x = 0.0, y = 0.0, z= 0.0 }
        }
       }
    },
    [0x00002000] = {
       MeshName = "男衣服30.mesh",
       MeshDIR = "/models/Player/male/",
       ShowName = "女主角1",
       Scale = 0.01,
       Image = "ptgw.tga",
       ImageIndex = 0,
       EffectList = {
        [0x00000001] = {
         BindBone = "",
         OffestPos = { x = 0.0, y = 0.0, z= 0.0 },
         Direction = { x = 0.0, y = 0.0, z= 0.0 }
        }
       }
    },
    [0x00000007] = {
       MeshName = "ninja.mesh",
       MeshDIR = "/models/Player/ninja/s",
       ShowName = "女主角1",
       Scale = 0.01,
       Image = "ptgw.tga",
       ImageIndex = 0,
       EffectList = {
        [0x00000001] = {
         BindBone = "",
         OffestPos = { x = 0.0, y = 0.0, z= 0.0 },
         Direction = { x = 0.0, y = 0.0, z= 0.0 }
        }
       }
    }
    }

    --------------------------------------------------------------------------------------

    LuaPlus::LuaObject ObjectData = GameGlobalManager::GetSingletonPtr()->getLuaState().Get()->GetGlobal( "tabObjectData" );
    for ( LuaTableIterator it( ObjectData ); it; it++ )
    {
       LuaPlus::LuaObject gameObj = it.GetValue();
       if ( gameObj.IsTable() )
       {
        //每个对象的表了
        printf( "对象:%08x\n", it.GetKey().ToInteger() );
       
        LuaPlus::LuaObject EffectObj = gameObj.GetByName( "EffectList" );
        if ( EffectObj.IsTable() )
        {
         for ( LuaTableIterator itr( EffectObj ); itr; itr++ )
         {
          if ( itr.GetValue().IsTable() )
          {
           printf( "对象:%08x的特效:%08x\n", it.GetKey().ToInteger(), itr.GetKey().ToInteger() );
          }
         }
        }    
       }   
    }


  • 相关阅读:
    深度学习笔记之关于基本思想、浅层学习、Neural Network和训练过程(三)
    深度学习笔记之关于特征(二)
    深度学习笔记之概述、背景和人脑视觉机理(一)
    初步认识深度学习笔记(一)
    EM(期望最大化)算法初步认识
    Ubuntu16.04下安装Tensorflow GPU版本(图文详解)
    Ubuntu16.04下安装Tensorflow CPU版本(图文详解)
    [转]粤语学习
    [转]微信公众平台开发(十) 消息回复总结
    [转]C#开发微信公众平台-就这么简单
  • 原文地址:https://www.cnblogs.com/lancidie/p/1903562.html
Copyright © 2011-2022 走看看