本文整理汇总了C#中LuaState.IsNil方法的典型用法代码示例。如果您正苦于以下问题:C# LuaState.IsNil方法的具体用法?C# LuaState.IsNil怎么用?C# LuaState.IsNil使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaState
的用法示例。
在下文中一共展示了LuaState.IsNil方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSetGetTable
public void TestSetGetTable()
{
LuaState L = null;
using (L = new LuaState())
{
L.CreateTable(0, 0);
Assert.Equal(1, L.GetTop());
L.PushInteger(2).PushString("Value");
L.SetTable(1);
Assert.Equal(1, L.GetTop());
L.PushInteger(1);
L.GetTable(1);
Assert.Equal(2, L.GetTop());
Assert.Equal(true, L.IsNil(-1));
L.PushInteger(2);
L.GetTable(1);
Assert.Equal(3, L.GetTop());
Assert.Equal(true, L.IsString(-1));
Assert.Equal("Value", L.ToString(-1));
}
}
示例2: TestIsNil
public void TestIsNil()
{
LuaState L = null;
using (L = new LuaState())
{
L.PushNil()
.PushNumber(123.45)
.PushInteger(987)
.PushString("Test")
.PushString("5.6")
.PushString("5D")
.PushString("5z")
.PushBoolean(true)
.PushCClosure(l => 0, 0)
//.PushLightUserData(DateTime.Now)
.PushGlobalTable()
;
Assert.True(L.IsNil(1));
Assert.False(L.IsNil(2));
Assert.False(L.IsNil(3));
Assert.False(L.IsNil(4));
Assert.False(L.IsNil(5));
Assert.False(L.IsNil(6));
Assert.False(L.IsNil(7));
Assert.False(L.IsNil(8));
Assert.False(L.IsNil(9));
Assert.False(L.IsNil(10));
Assert.False(L.IsNil(11));
Assert.False(L.IsNil(12));
}
}
示例3: TestRawSetGetP
public void TestRawSetGetP()
{
LuaState L = null;
using (L = new LuaState())
{
L.CreateTable(0, 0);
Assert.Equal(1, L.GetTop());
L.PushString("Value");
L.RawSetP(1, new IntPtr(2));
Assert.Equal(1, L.GetTop());
L.RawGetP(1, new IntPtr(1));
Assert.Equal(2, L.GetTop());
Assert.Equal(true, L.IsNil(-1));
L.RawGetP(1, new IntPtr(2));
Assert.Equal(3, L.GetTop());
Assert.Equal(true, L.IsString(-1));
Assert.Equal("Value", L.ToString(-1));
}
}