Lua Ldoc表的文档

时间:2016-04-05 07:06:13

标签: lua code-documentation

我想使用Ldoc记录一个表。 documentation表示

enter image description here

好的,这看起来不错,但是当我将格式化应用到我的桌子时:

--- A table of mappings between NodOn remote scene codes and a text description.
nodonSceneTableVerbose = {
    [10]="Button 1 Single Press",   -- Button 1 Single Press
    [20]="Button 2 Single Press",   -- Button 2 Single Press
    [30]="Button 3 Single Press",   -- Button 3 Single Press
    [40]="Button 4 Single Press",   -- Button 4 Single Press
    [13]="Button 1 Double Press",   -- Button 1 Double Press
    [23]="Button 2 Double Press",   -- Button 2 Double Press
    [33]="Button 3 Double Press",   -- Button 3 Double Press
    [43]="Button 4 Double Press",   -- Button 4 Double Press
    [12]="Button 1 Hold Press",     -- Button 1 Hold Press
    [22]="Button 2 Hold Press",     -- Button 2 Hold Press
    [32]="Button 3 Hold Press",     -- Button 3 Hold Press
    [42]="Button 4 Hold Press",     -- Button 4 Hold Press
    [11]="Button 1 Hold Released",  -- Button 1 Hold Released
    [21]="Button 2 Hold Released",  -- Button 2 Hold Released
    [31]="Button 3 Hold Released",  -- Button 3 Hold Released
    [41]="Button 4 Hold Released"   -- Button 4 Hold Released
}

我得到了这个结果

enter image description here

这不是我的预期。 ldoc命令没有产生错误。有什么问题?

1 个答案:

答案 0 :(得分:1)

事实证明,你不能在将元素设置为[10]的表格上使用inferring more from code,依此类推。相反,您可以手动定义字段:

--- A table of mappings between NodOn remote scene codes and a text description.
-- @table nodonSceneTableVerbose
-- @field 10 Button 1 Single Press
-- @field 20 Button 2 Single Press
-- @field 30 Button 3 Single Press
-- @field 40 Button 4 Single Press
-- @field 13 Button 1 Double Press
-- @field 23 Button 2 Double Press
-- @field 33 Button 3 Double Press
-- @field 43 Button 4 Double Press
-- @field 12 Button 1 Hold Press
-- @field 22 Button 2 Hold Press
-- @field 32 Button 3 Hold Press
-- @field 42 Button 4 Hold Press
-- @field 11 Button 1 Hold Released
-- @field 21 Button 2 Hold Released
-- @field 31 Button 3 Hold Released
-- @field 41 Button 4 Hold Released
nodonSceneTableVerbose = {
    [10]="Button 1 Single Press",
    [20]="Button 2 Single Press",
    [30]="Button 3 Single Press",
    [40]="Button 4 Single Press",
    [13]="Button 1 Double Press",
    [23]="Button 2 Double Press",
    [33]="Button 3 Double Press",
    [43]="Button 4 Double Press",
    [12]="Button 1 Hold Press",
    [22]="Button 2 Hold Press",
    [32]="Button 3 Hold Press",
    [42]="Button 4 Hold Press",
    [11]="Button 1 Hold Released",
    [21]="Button 2 Hold Released",
    [31]="Button 3 Hold Released",
    [41]="Button 4 Hold Released" 
}