LDoc Problem

111 views
Skip to first unread message

Scott Morgan

unread,
Jan 15, 2026, 10:20:19 AM (6 days ago) Jan 15
to lu...@googlegroups.com
I'm trying to add some LDoc info to a module but I'm running into a
problem with the way the module is written compared to what LDoc expects.

It seems LDoc wants a form like:

local _M = {}

_M.func = function(...) end

return _M

Where as my module is in the form:

local function func(...) end

return {
func = func,
}

I just can't seem to get LDoc to recognise that layout. Is it possible,
or does it require a refactor to match the _M style?

Scott

Thijs Schreijer

unread,
Jan 16, 2026, 1:31:51 AM (5 days ago) Jan 16
to lu...@googlegroups.com

Scott Morgan

unread,
Jan 16, 2026, 8:35:39 AM (5 days ago) Jan 16
to lu...@googlegroups.com
On 16/01/2026 06:31, 'Thijs Schreijer' via lua-l wrote:
>
> On Thu, 15 Jan 2026, at 16:20, 'Scott Morgan' via lua-l wrote:
>> I'm trying to add some LDoc info to a module but I'm running into a
>> problem with the way the module is written compared to what LDoc expects.
>>
>> ...
That worked, thanks. Had tried that @export tag, but in the wrong way.

Another issue that just raised it's head:
LDoc doesn't work under Lua 5.5. Lots of assigning to loop vars.

Scott

Thijs Schreijer

unread,
Jan 17, 2026, 3:42:57 PM (4 days ago) Jan 17
to lu...@googlegroups.com


On Fri, 16 Jan 2026, at 14:35, 'Scott Morgan' via lua-l wrote:
> Another issue that just raised it's head:
> LDoc doesn't work under Lua 5.5. Lots of assigning to loop vars.
>
> Scott
>

Those should be fairly easy to fix. That said, the ldoc repo contains a docker file based on 5.4, so you could use that instead.

Thijs
Reply all
Reply to author
Forward
0 new messages