cloudwu / sproto

Yet another protocol library like google protocol buffers , but simple and fast.
MIT License
942 stars 253 forks source link

关于二维数组这么定义sproto #58

Closed OpenGamex closed 7 years ago

OpenGamex commented 7 years ago

cards = { {1, 2, 3 }, {2, 3, 5 }, {4, 5, 6} }

看了sproto语法,好像没有这种二维数组的定义

cloudwu commented 7 years ago

不支持

najoast commented 4 years ago

替代方案:

  1. 如果二级数组元素数量固定,可以展开成1组数组,再带一个二级数组的长度。
  2. 如果二级数组元素数量不固定,也是展开成1组数组,同时再发一个表示每个二级数组长度的数组。
najoast commented 4 years ago
.Cards {
     data    0 : *integer
     length 1 : integer
}

cards = {
       data = {1,2,3,2,3,5,4,5,6},
       length = 3,
}