Search results
Results from the WOW.Com Content Network
Lua 1.0 was designed in such a way that its object constructors, being then slightly different from the current light and flexible style, incorporated the data-description syntax of SOL (hence the name Lua: Sol meaning "Sun" in Portuguese, and Lua meaning "Moon").
The detailed semantics of "the" ternary operator as well as its syntax differs significantly from language to language. A top level distinction from one language to another is whether the expressions permit side effects (as in most procedural languages) and whether the language provides short-circuit evaluation semantics, whereby only the selected expression is evaluated (most standard ...
This text calls the Lua script itself, which is housed in the Module: namespace. The effect of this call is to send the information within the #invoke block to the Lua module, and to replace everything within the brackets with a piece of text that it sends back in return. (Literally, in the "return" statement)
They focus mainly upon what you might find different in Lua. Lua is dynamically typed. There's no static typing at all. From a syntactic point of view, think BASIC (or even COMAL) without line numbers and colons rather than C/C++/Java, Lisp/Scheme, or Forth. There's no begin, but most control structures have an end; for needs a do and if needs ...
To expand such a script with more (invocable) functions, one adds them between the local statement at the top and the return statement at the bottom. (Non-invocable local functions can be added before the local statement.) The local variable doesn't have to be named p. It could be named any valid Lua variable name that you like.
The problem is that in modules with a mixture of tabs and spaces, editors will write their code in CodeEditor with 4-column tabs, and they will expect their code to be indented in the same way that they see in CodeEditor. Then when they save the page, they will see the same code in GeSHi with 8-column tabs, and it will look strange.
Even the addition of an extra if-statement for every Lua variable has little drag on speed, compared to slowing a template by perhaps 50% if adding similar if-expressions inside a markup template. Feel free to have many sections of debug-display added into a Lua module, or add several parameter validation tests as extra if-statements to check ...
Template:Ifnoteq then show tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter. This is useful when the first parameter is a {{#invoke: of a Lua module that returns a value for which a specific exception is required.