ldoc icon indicating copy to clipboard operation
ldoc copied to clipboard

Representing module with constants

Open DifferentialOrange opened this issue 3 years ago • 2 comments

I have a simple module

return {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

and I need to describe what CONST1 and CONST2 fields store and how they should be interpreted.

I understand that it is possible to write ldoc if my module was like that:

local const = {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

return {
   const = const,
   -- something else
}

but I don't see any ways to describe a string (or number) field in module itself (similar to @function and @table).

DifferentialOrange avatar Jan 13 '22 09:01 DifferentialOrange

See Inferring more from code. I would expect this work somehting like

-- @field CONST1 foo bar
-- @field CONST2 baz qiz
local const = {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

return const

Does that not do what you expect?

alerque avatar Jan 17 '22 11:01 alerque

See Inferring more from code. I would expect this work somehting like

-- @field CONST1 foo bar
-- @field CONST2 baz qiz
local const = {
    CONST1 = 'value1',
    CONST2 = 'value2',
}

return const

Does that not do what you expect?

Yes, page is empty if I try this. If I mix @table, page is empty too. image

I use ldoc vs 1.4.6 and Tarantool 2.10.0-beta2-0-g9d80b68b9 as a lua interpreter.

DifferentialOrange avatar Jan 17 '22 15:01 DifferentialOrange