LuaDoc (for Chili etc)?

LuaDoc (for Chili etc)?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

LuaDoc (for Chili etc)?

Post by Anarchid »

So, i've been prowling through the recent advances, and ran into this thing: Chili.

And then i was like googling it, and ran into its page on spring wiki.

And it had, like "with this page and reverse engineering you'll get to far places", which now does sound kinda scary, especially since chili seems to aim for a swing-esque delfi-like framework.

So then i was like 'meh, maybe is there anything like javadoc for lua so it would be easier for everyone', and BAM! luadoc.

So, maybe someone could add that to at least chili, or maybe some other widely used/essential pieces of lua that spring uses/should use/get used in spring? I'd volunteer, but i have no idea how chili works, so it'd be that reverse engineering again :P

(unless i'm to be convinced it's not that complicated)
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: LuaDoc (for Chili etc)?

Post by Petah »

+1
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: LuaDoc (for Chili etc)?

Post by knorke »

The chili tutorials on the wiki are all written by sunspot who basically wrote them as he was learning himself. He also made a game which is the "simplest" spring game that makes use of chili. If you look at the date, that wiki page was made quite recently; before it always went like this.*
I think the reason why there still is no better documentation is simply that only few people have the knowledge and none of them has the will or time.
Best source for informations is probally jK and some others from zk ie Carrepairer, Licho, Google Frog, KingRaptor (random names )

*just in case:
there is a github, no need to get the files by picking mods apart: https://github.com/jk3064/chiliui

(unless i'm to be convinced it's not that complicated)
Seeing how you made your own UI with Metropolis Spring in the past it should be doable for you ;)
maybe some other widely used/essential pieces of lua
Do such things exist? Sure there are widgets that "all" games use (ie healthbars, custom formations) but those work by c&p-ing the file. Some other gadgets (ie jumpsets, morphing) can easily be configured by editing some config file. Those often contains comments in case it is not obvious anyway. Other stuff is simply not made with reusability in mind.
The only other thing I can think of that maybe needs docu is lups (lua particle system)
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: LuaDoc (for Chili etc)?

Post by Anarchid »

I think the reason why there still is no better documentation is simply that only few people have the knowledge and none of them has the will or time.
That's pretty much the whole argument for automated composition of docs from inline comments (presumably to be left by the developer/s at write-time), which is more or less what i was hoping to impose on Chili :P

After all, the engine itself uses these (in form of doxygen), and imo it's way easier to write comments write-time than manually compile documentation later.

Edit: especially as it seems the code itself is quite commented on its own. Now, if the comments were in luadoc format, we could just "$luadoc -d chilidoc chili" and have our full api documentation!
Seeing how you made your own UI with Metropolis Spring in the past it should be doable for you
Hum. Maybe i'll rtfs some then and see if it is. (there will still be quite a few months before i'm actually planning to get back to spring, but preparing ground for an invasion is always a good plan)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: LuaDoc (for Chili etc)?

Post by smoth »

WHY DID YOU LEAVE!?!? I was interested in your project!
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: LuaDoc (for Chili etc)?

Post by Anarchid »

WHY DID YOU LEAVE!?!? I was interested in your project!
That was due to the Conspiracy of Hardware and Wetware issues acting together as a force majeure.

Though that's hardly relevant to the topic :P
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: LuaDoc (for Chili etc)?

Post by smoth »

truthfully coders that document as they go are rare..

ones that think about configuration and reuse are equally rare.

documentation always falls on the "NOT ENOUGH TIME" block of things to do. There was a wiki about ca's stuff and I was going to fill it out for chili but then I stopped caring when I realized I would be documenting other people's projects when my own had so much work aka "NOT ENOUGH TIME"

It would be nice to see more documentation but chili is pretty straight forward to read and when you are looking for a quick answer JK, car, kr etc are all pretty accessible. I am constantly doing new examples as well. Spring is less about "go and decipher it" and more about "look at these examples"
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: LuaDoc (for Chili etc)?

Post by Anarchid »

truthfully coders that document as they go are rare..

ones that think about configuration and reuse are equally rare.

documentation always falls on the "NOT ENOUGH TIME" block of things to do. There was a wiki about ca's stuff and I was going to fill it out for chili but then I stopped caring when I realized I would be documenting other people's projects when my own had so much work aka "NOT ENOUGH TIME"
But that's pretty much the point why i'm advocating luadoc here.

There's plenty of comments in the code - and most coders that are not cowboys seem to leave plenty of those. The comments in Chili code also seem to follow some format conventions (such as starting with --// whereas lua syntax only needs --).

Distilled to bits, the idea is that if the format for the comments was a bit different, these same comments could be used to auto-generate the documentation.

So 1) it wouldn't take any notable extra time on the coder's part (since the comments are there anyway and the docblock is essentially a comment with stricter format) , and
2) it would not take more time than 500 ms per iteration to maintain the documentation relevant (as opposed to the 'need to manually write up documentation in wiki).

Of course, such documentation would not be very juicy and will probably be very-very dry (well look at what your typical javadoc pops out), but it would be something to start with (at the very least, providing the listing of what you can use without having to rtfs each relevant file).

Anyway, if i get some more spare time this week, i'll probably try to inflict some luadoc on chili and just see what happens. Running luadoc on the current code state doesn't yield anything useful at all, so maybe lua's fluid nature is just too resistant to doc-generation this way (so far of what i've met, even undocumented javascript vs jsdoc have yielded better results - so it just might be that example&rtfs is the better option altogether).
Last edited by Anarchid on 12 Oct 2011, 21:43, edited 1 time in total.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: LuaDoc (for Chili etc)?

Post by zwzsg »

knorke wrote:
maybe some other widely used/essential pieces of lua
Do such things exist? Sure there are widgets that "all" games use (ie healthbars, custom formations) but those work by c&p-ing the file. Some other gadgets (ie jumpsets, morphing) can easily be configured by editing some config file. Those often contains comments in case it is not obvious anyway. Other stuff is simply not made with reusability in mind.
The only other thing I can think of that maybe needs docu is lups (lua particle system)
I wish my single player menu / savegame / mission thingy had made it to that point. But then there's even less doc about it, so. :P
Post Reply

Return to “Lua Scripts”