Closed AaronChenJH closed 2 years ago
init.lua
is the default file LuaDox uses if you pass it an entire directory. It's generally just a bunch of require()
statements that LuaDox can then follow to discover all the different individual lua files it should parse. You can see an example here.
You don't need to have an init.lua
though. Rather than a directory, you can pass specific files to LuaDox. For example:
python luadox *.lua
But the disadvantage with this approach is that LuaDox will parse the files in alphabetical order, and this probably isn't the right order needed to resolve references.
Basically, you want to give LuaDox the entry point into your Lua project that Lua itself uses. For libraries, that's often init.lua
because it includes a bunch of require()
invocations that LuaDox can follow in order. But for applications, maybe you have a main.lua
or something similar. You can pass this single file to LuaDox and it will crawl all require()
references from this file, and document everything it finds.
python luadox main.lua
Hope that helps.
Thank you very much!This is very useful!
Cheers @AaronChenJH . Will close this issue, but feel free to follow up if you have further questions.
hello!I have some questions. When I run the code,
D:\UGPRoot\game\Content\Script>python luadox -c luadox.conf [INFO] parsing D:\UGPRoot\game\Content\Script\init.lua [INFO] preprocessing 0 pages [INFO] generating search index
I don't understand the structure of the init.lua. Can you provide a example of the init,lua? Thanks!