Exemplo n.º 1
0
 public void TestToUserData()
 {
     LuaState L = null;
     using (L = new LuaState())
     {
         DateTime dt = DateTime.Now;
         LuaFunction f = l => 0;
         L.PushNil()
             .PushNumber(123.45)
             .PushInteger(987)
             .PushString("Test")
             .PushString("5.6")
             .PushString("5D")
             .PushString("5z")
             .PushBoolean(true)
             .PushCClosure(f, 0)
             .PushLightUserData(dt)
             .PushGlobalTable()
             ;
         Assert.Equal(null, L.ToUserData(1));
         Assert.Equal(null, L.ToUserData(2));
         Assert.Equal(null, L.ToUserData(3));
         Assert.Equal(null, L.ToUserData(4));
         Assert.Equal(null, L.ToUserData(5));
         Assert.Equal(null, L.ToUserData(6));
         Assert.Equal(null, L.ToUserData(7));
         Assert.Equal(null, L.ToUserData(8));
         Assert.Equal(null, L.ToUserData(9));
         Assert.Equal(dt, L.ToUserData(10));
         Assert.Equal(null, L.ToUserData(11));
         Assert.Equal(null, L.ToUserData(12));
     }
 }