本文整理汇总了C#中LuaValue.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LuaValue.ToString方法的具体用法?C# LuaValue.ToString怎么用?C# LuaValue.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaValue
的用法示例。
在下文中一共展示了LuaValue.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LuaException
public LuaValue this[LuaRuntime runtime, LuaValue keyValue]
{
get
{
var name = keyValue.ToString();
ScriptMemberWrapper wrapper;
if (!members.TryGetValue(name, out wrapper))
throw new LuaException(MemberNotFoundError(name));
return wrapper.Get(runtime);
}
set
{
var name = keyValue.ToString();
ScriptMemberWrapper wrapper;
if (!members.TryGetValue(name, out wrapper))
throw new LuaException(MemberNotFoundError(name));
wrapper.Set(runtime, value);
}
}
示例2: switch
public LuaValue this[LuaRuntime runtime, LuaValue key]
{
get
{
switch (key.ToString())
{
case "X": return X;
case "Y": return Y;
default: throw new LuaException("CPos does not define a member '{0}'".F(key));
}
}
set
{
throw new LuaException("CPos is read-only. Use CPos.New to create a new value");
}
}
示例3: switch
public LuaValue this[LuaRuntime runtime, LuaValue key]
{
get
{
switch (key.ToString())
{
case "X": return X;
case "Y": return Y;
case "Facing": return Traits.Util.GetFacing(this, 0);
default: throw new LuaException("CVec does not define a member '{0}'".F(key));
}
}
set
{
throw new LuaException("WVec is read-only. Use CVec.New to create a new value");
}
}
示例4: GetValueString
public string GetValueString(LuaValue luaValue)
{
if (luaValue == null)
return "";
switch (luaValue.Type)
{
case LuaValueType.NIL:
return "nil";
case LuaValueType.BOOLEAN:
return luaValue.AsBoolean().ToString();
case LuaValueType.NUMBER:
return luaValue.AsNumber().ToString("R");
case LuaValueType.TILDE_METATABLE:
return "metatable";
case LuaValueType.TILDE_ENVIRONMENT:
return "environment";
case LuaValueType.TILDE_UPVALUES:
return "upvalues";
default:
if (mValueCache.Contains(luaValue))
return mValueCache.Get(luaValue);
else
return "Unknown:" + luaValue.ToString();
}
}
示例5: 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 + "}");
}