Foldit Wiki
Advertisement
BandAdd

The function detail page for band.Add.

Each of the functions listed on the index pages Foldit Lua Functions or Foldit Lua Functions (v1) has can have its own "detail" page. The automatically generated index pages include links to the detail pages. When a detail page exists, the link appears in blue. Links to non-existent pages are in red. Clicking one of these "redlinks" gives you the opportunity to create the missing detail page.

There are several tips and tricks which can make a new detail page easier.

First, pick an existing page as a guide. The function band.Add has it all - a complicated function with lots of parameters, a long description of how the function works, and a detailed example. There's even a image that show how band.Add's Greek-letter arguments define a point in space. (Most other functions do not lend themselves to images.)

Whether it's band.Add or a less complex example, the next step is to look at the wiki markup using the "classic editor". This is available as an option in the wiki's "edit" dropdown, and you can also set the classic editor as your default editor in wiki settings.

In the classic editor, you'll normally see a wiki macro as the first item on a function detail page. For band.Add, the macro is


 {{LuaFunctionDetail|returns=integer|namespace=band|functionname=Add|
 arguments=(integer segmentOrigin, integer segmentXAxis, 
 integer segmentYAxis, number rho, number theta, number phi,
 [integer atomIndexOrigin], [integer atomIndexXAxis], [integer atomIndexYAxis])|
 description=Add a band to empty space.|oldfunctionname=New to V2}}

The LuaFunctionDetail macro provides the formal description of the function, in a style somewhat similar to a Linux/Unix man page.u

The LuaFunctionDetail macro uses the same parameters as the LuaFunction macro, but results in slightly different formatting. The Foldit Lua Functions page contains the corresponding LuaFunction macro:


 {{LuaFunction|returns=integer|namespace=band|functionname=Add|
 arguments=(integer segmentOrigin, integer segmentXAxis, 
 integer segmentYAxis, number rho, number theta, number phi,
 [integer atomIndexOrigin], [integer atomIndexXAxis], [integer atomIndexYAxis])|
 description=Add a band to empty space. Returns band number.|oldfunctionname=New to V2|}}

So the first step is to simply copy the LuaFunction macro from the index page to the detail page, and change the macro name to LuaFunctionDetail. As shown here, you may also adjust the text as needed for clarity. (For band.Add, the description for the LuaFunctionDetail macro is slightly shorter than the one in the original LuaFunction macro.)

The LuaFunction macros are generated by the process described in Foldit Lua Functions List Generation. You can also obtain the LuaFunction macro from the file generated by the last step in the process.

The next step is to write a good description of what the function does. Consider including items such as:

  • general statement of purpose
  • meaning and values of the input parameters/arguments
  • meaning and values of the returned value or values, if any
  • other related Foldit functions (especially for getters and setters)
  • related Foldit tools or controls (such as Shake for structure.ShakeSidechainsAll)

There is another wiki macro called LuaFunc, which generates references to functions. For band.Add, the reference is:

{{LuaFunc|ns=band|func=Add}}

The goal of LuaFunc is economy, so the syntax is different than the LuaFunction and LuaFunction detail macros. It's basically a shortcut to a wiki link using double brackets, so the same as coding:

[[Foldit Lua Function band.Add|band.Add]]

When LuaFunc is used on its own page, the result is boldface text, otherwise it's a blue or red wiki link to a function detail page. LuaFunc can be used on any page in the Foldit wiki.

For more complicated functions, an example can be helpful. Make the example a section on its own, with this wiki markup:

==Example==

The tags <pre> and </pre> can be used to format code and output.

For example, the markup:

<pre>band.Add ( 2, 1, 3, 20, 0, 0 )</pre>

appears as:

band.Add ( 2, 1, 3, 20, 0, 0 ) 

The following wiki directives may improve the look of your detail page when you have multiple sections.

  • __NOTOC__
  • __NOEDITSECTION__

The __NOTOC__ directive tells the wiki not to include a table of contents when there are multiple sections. The __NOEDITSECTION__ directive suppresses the "edit" link on section headers.

Add the wiki categories "Script tutorial" and "Foldit LUA functions" to the detail page.

Advertisement