Extension Terminology
Return to Extensions Gallery
rating: +1+x

Let's give each part of an extension's code a name, so that it can be easily referred to.

This is open for discussion (and this page is editable) so feel free to modify this page if you feel anything obvious has been missed.

extension-breakdown.png

Above is an extension breakdown. It defines:

  • Extension : A block of code that is capable of being downloaded by STE and used to extend functionality. An extension for STE is a series of instructions, therefore it can also be called a program.
  • Header : The first two lines in an Extension. The header defines the name of the extension and information about the creator(s) that will be shown in STE.
  • Body : Anything below the header. The body consists of one or more statements. Not shown in above image.
  • Statement : Statements can be defined on any line, except lines 1 and 2 (which are reserved for the header). Each statement generally results in STE performing some action. A statement consists of an instruction, and some details that tell STE how to perform that instruction.
    • Instruction : The first part of a statement. You might want to read the list of valid instructions.
    • Instruction details : Some details that tell STE how to perform the proceeding instruction. For example, it might tell STE to write some text to the text area, or to prompt the user for a value (and to store that value in a variable).
      • Variable : The instruction details might sometimes include the name of a variable. A variable is a way for you to store information that can be re-used later. Think of a variable as a name written on a box. You can store whatever data you want in the box, but to retrieve it you need to know the variable name (so you know which box to look into). Read more on Wikipedia.

More about the instruction details:

The layout and format of the instruction details depends on which instruction it is for. As an example, the append instruction accepts any string in the details section, and it can also accept a variable name in the format {$variable_name}.

A single space separates an instruction from its instruction details. If you add additional spaces, they will be treated as if they are part of the details section (this allows you to add blank spaces to the beginning of a line).


Discussion

wdavatar?user=leiger
leiger

02 Jan 2011 02:06. Edited 0 times. (Edit, Permalink)
Just some clarification…

These are instructions:

  • append
  • delete
  • input
  • input-int
  • input-boolean

These are examples of variables

  • my_variable
  • Your wikidot username
  • random word

And this is an example of using a variable with an instruction:

  • append This is {$my_variable}
  • append Your username: {$Your wikidot username}
  • append This is a {$random word} sentence.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

02 Jan 2011 02:30. Edited 0 times. (Edit, Permalink)
I think I know what the problem is… I just assumed that everyone knew what the term variable means, but as HTML and CSS don't use variables, that's probably a mistake on my part. Javascript is one of the few web programming languages that does use variables.

Does this help explain how it works?

variables-explained.png

Included page "inc:signature" does not exist (create it now)

wdavatar?user=
(user deleted)

02 Jan 2011 02:41. Edited 0 times. (Edit, Permalink)
This is clear and I was over-thinking the whole variable thing when I was trying to update the documentation and this page. input, input-boolean, etc. are instructions and I wasn't thinking in those terms. It was the programmer's side of my brain thinking in terms of declaring variables before using them, when the input instructions are just that - instructions - and the variables don't need to be defined before using them.

Included page "inc:signature" does not exist (create it now)

wdavatar?user=leiger
leiger

02 Jan 2011 03:01. Edited 0 times. (Edit, Permalink)
Nope, no need to define them before using them in this :)

Initialising them (actually giving them a value using input or one of it's variants) is the equivalent to declaring it first.

Included page "inc:signature" does not exist (create it now)

Post Reply

Add reply on "Extension Terminology"