Example #1
0
 public static void PushMessage(this ILuaState self, IMessage nm, PB_Message pb)
 {
     self.PushValue(1);
     for (int i = 0; i < pb.Count; ++i)
     {
         var field = pb[i];
         if (field.repeated)
         {
             self.GetField(-1, field.name);
             if (!self.IsTable(-1))
             {
                 self.Pop(1);
                 self.PushString(field.name);
                 self.NewTable();
             }
             int count = nm.readU32();
             for (int n = 0; n < count; ++n)
             {
                 self.PushField(nm, field);
             }
             self.SetTable(-3);
         }
         else
         {
             self.PushField(nm, field);
         }
     }
 }