在C#里面怎样操作lua的table数据类型

在C#里面怎样操作lua的table数据类型


哔哔one
浏览 1820回答 2
2回答

饮歌长啸

LuaInterface.LuaTable ob = XLuaManager.Inst.Call("CombineDef.GetCombineItems", mItemType, mItemId)[0] as LuaInterface.LuaTable;XTools.Log("**** --- {0}", ob.Values.Count); //ob.Values[0];// IEnumerator itr = ob.Keys.GetEnumerator();// while(itr.MoveNext())// {// //KeyValuePair<XSkillType, int> pair = (KeyValuePair<XSkillType, int>)itr.Current;// string nnn = (string)itr.Current;// XTools.Log("---{0}", nnn);// }IEnumerator itr = ob.Values.GetEnumerator();int i = 0;while(itr.MoveNext()){LuaInterface.LuaTable tb = itr.Current as LuaInterface.LuaTable;IEnumerator it2 = tb.Values.GetEnumerator();XTools.Log("=={0}---key{1}", tb.Values.Count, i);int j = 0;while (it2.MoveNext()){//KeyValuePair<int, int> pair = (KeyValuePair<int, int>)it2.Current;XTools.Log("---{0},{1}--------key:{2}{3}", it2.Current.GetType().ToString(), (double)it2.Current, i, ++j);}i++;}LuaInterface.LuaTable ob = XLuaManager.Inst.Call("CombineDef.GetCombineItems", mItemType, mItemId)[0] as string;lua定义结构体:Npc.BubbleProperty ={Silence = { Weight = 200 }, -- 沉默Task = { Weight = 50, nIndex = "Task" },-- 普通泡泡Normal = { Weight = 50, nIndex = "Normal" }, -- 任务泡泡};local tbPos ={[1] = { nX = nX,nY = nY };[2] = { nX = nX - nSpan,nY = nY };[3] = { nX = nX + nSpan,nY = nY };[4] = { nX = nX,nY = nY - nSpan };[5] = { nX = nX,nY = nY + nSpan };[6] = { nX = nX - nSpan,nY = nY + nSpan };[7] = { nX = nX + nSpan,nY = nY + nSpan };[8] = { nX = nX + nSpan,nY = nY - nSpan };[9] = { nX = nX - nSpan,nY = nY - nSpan };};

慕斯王

大约是这个样子的Table&nbsp;TB&nbsp;= new Table();TableRow&nbsp;TR&nbsp;= new TableRow();TableCell&nbsp;TC&nbsp;= new TableCell();TR.Cells.Add(TC);TB.Rows.Add(TR);
打开App,查看更多内容
随时随地看视频慕课网APP