Posts: 21
Threads: 3
Joined: Sep 2014
Thanks: 2
Given 4 thank(s) in 4 post(s)
Hi I got a question about info.lua.
Do I just have to register the commands in the info.lua or do I need to register the commands using the BindCommand function and the info.lua is just a info table?
Another question releated to info.lua, the Alias var in commands, can it be an array or is it only a string?
Posts: 952
Threads: 16
Joined: May 2013
Thanks: 66
Given 105 thank(s) in 89 post(s)
Can we get the server to do this automatically?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
We could, theoretically, when it finds out that the plugin has the Info.lua file, it could process it this way. But when should the server do that? Before calling Initialize()? Or after?
Posts: 21
Threads: 3
Joined: Sep 2014
Thanks: 2
Given 4 thank(s) in 4 post(s)
09-16-2014, 03:54 AM
(This post was last modified: 09-16-2014, 03:56 AM by tryy3.)
Hmm... after checking the Article on the Info.lua I got two questions,
1) When/where is AdditionalInformation displayed? is it only for external services, like if you want to use it on a website or can you actually see the text in a command or something?
2) Can you have multiple lines in AdditionalInformation Table? like if you add a \n will that make it a new line?
Maybe add Author property too?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
AdditionalInformation is displayed in the external documentation only - use the MCServer/Plugins/InfoDump.lua script together with a Lua executable to actually generate the docs. It is expected to be an array-table of tables, each item has a Title and Contents members, each a string. Each such item is output as a separate section in the documentation, with the specified heading. To split a paragraph, simply put two newlines in the string.
Have a look at the Gallery plugin (that is referenced in the Info.lua article), it has probably the most complete Info.lua file, because the technology was developed on that plugin. GalExport and WorldEdit have a decent info files, too. The info file for the Core is somewhat lacking, it could use some polishing touches.
Feel free to open a PR for improvements in the Info.lua article (it is stored in the main MCS repo at MCServer/Plugins/APIDump/InfoFile.html). I tried to write it as good as I can, but I'm not a native English speaker and I developed the technology, which makes it somewhat difficult for me to judge the article's clarity.
As for the Author property, we discourage putting "signatures" in the code, because it discourages cooperation. If someone's "signed" in a file, others are reluctant to make changes to such a file simply because they fear the authority. We prefer to have a CONTRIBUTORS file that lists the contributors - that way they get the attribution, but don't disturb the improvements process. Of course for your own plugin you are free to choose any schema you want.
--
@STR_Warrior what do you mean? That if the server detects the Info.lua file, it would auto-load the InfoReg.lua helper file so that the plugin can call it without the first "dofile"? That would be a small help but it would make the server somewhat inconsistent, special cases like that make changing the behavior later on nearly impossible.