为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

C#
哔哔one 2019-03-04 10:04:21
在C#里面怎样操作lua的table数据类型
查看完整描述

2 回答

?
饮歌长啸

TA贡献1951条经验 获得超3个赞

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 };
};



查看完整回答
反对 回复 2019-03-16
?
慕斯王

TA贡献1864条经验 获得超2个赞

大约是这个样子的
Table TB = new Table();
TableRow TR = new TableRow();
TableCell TC = new TableCell();
TR.Cells.Add(TC);
TB.Rows.Add(TR);

查看完整回答
反对 回复 2019-03-16
  • 2 回答
  • 0 关注
  • 1818 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信