本文整理汇总了C#中SharpLua.LuaTypes.LuaTable.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LuaTable.ToString方法的具体用法?C# LuaTable.ToString怎么用?C# LuaTable.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpLua.LuaTypes.LuaTable
的用法示例。
在下文中一共展示了LuaTable.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintTable
private static void PrintTable(LuaTable tbl, string indent, LuaValue _key = null)
{
/* sample output:
table: 002CCBA8
{
field = value
X = 10
y = function: 002CCBA8
}
*/
string i = indent;
A8Console.Write(i);
if (_key != null)
A8Console.Write(_key.ToString() + " = ");
A8Console.WriteLine(tbl.ToString() + "\n" + i + "{");
foreach (LuaValue key in tbl.Keys)
{
LuaValue v = tbl.GetValue(key);
if (v.GetTypeCode() == "table")
{
// check that its not a reference of itself
if (!scanned.ContainsKey(key))
{
scanned.SetKeyValue(key, v);
PrintTable(v as LuaTable, i + " ", key);
}
else
{
A8Console.WriteLine(i + " " + key.ToString() + " = " + v.ToString());
}
}
else
{
scanned.SetKeyValue(key, v);
A8Console.WriteLine(i + " " + key.ToString() + " = " + v.ToString());
}
}/*
foreach (LuaValue key in tbl.MetaTable.Keys)
{
A8Console.WriteLine(i + "(MetaTable): " + key.ToString() + " = " + tbl.MetaTable.GetValue(key).ToString());
}*/
A8Console.WriteLine(i + "}");
}