Example #1
0
 public void TestPushFString()
 {
     LuaState L = null;
     using (L = new LuaState())
     {
         L.PushFString("-s-d-", 1234);
         L.PushFString("-%s-", "Text");
         L.PushFString("-%f-", 123.45);
         L.PushFString("-%d-", 987);
         L.PushFString("-%s-%s-", "Str", "Text");
         L.PushFString("-%s-%f-", "Str", 123.45);
         L.PushFString("-%s-%d-", "Str", 987);
         L.PushFString("-%f-%s-", 11.22, "Text");
         L.PushFString("-%f-%f-", 11.22, 123.45);
         L.PushFString("-%f-%d-", 11.22, 987);
         L.PushFString("-%d-%s-", 9988, "Text");
         L.PushFString("-%d-%f-", 9988, 123.45);
         L.PushFString("-%d-%d-", 9988, 987);
         Assert.Equal(13, L.GetTop());
         Assert.Equal(LuaType.String, L.Type(-1));
         Assert.Equal("-s-d-", L.ToString(1));
         Assert.Equal("-Text-", L.ToString(2));
         Assert.Equal("-123.45-", L.ToString(3));
         Assert.Equal("-987-", L.ToString(4));
         Assert.Equal("-Str-Text-", L.ToString(5));
         Assert.Equal("-Str-123.45-", L.ToString(6));
         Assert.Equal("-Str-987-", L.ToString(7));
         Assert.Equal("-11.22-Text-", L.ToString(8));
         Assert.Equal("-11.22-123.45-", L.ToString(9));
         Assert.Equal("-11.22-987-", L.ToString(10));
         Assert.Equal("-9988-Text-", L.ToString(11));
         Assert.Equal("-9988-123.45-", L.ToString(12));
         Assert.Equal("-9988-987-", L.ToString(13));
     }
 }