User:RexxS/sandbox/GCI04

When we call a Lua module, we use the #invoke: syntax like this: That calls the function "fnname" from the module "MyModule" and passes to that function five parameters. We say that the first three are unnamed or positional parameters, because their position in the list of unnamed parameters determines how we refer to them in the module. For named parameters, it doesn't matter what order they are in the #invoke; you can even mix named and unnamed parameters – only the order of the unnamed parameters has any significance.

We we write the module we use something like That creates an object called "frame" which holds the parameters in a Lua table (a list in this case) called "args". So  is a table of parameters.

You access each parameter by using its index, which are the numbers 1, 2, 3, etc. for unnamed parameters, and the name (as a string) used to pass the parameter in the #invoke. For the call above, we would use: For the named parameters, you can also use: This is called "syntactic sugar", because it helps programmers who are more accustomed to OOP to use Lua. Note that only the first method of referring, e.g., works if there is a hyphen in "this-name".
 * for the first unnamed parameter (whose value is par1)
 * for the second unnamed parameter (whose value is par2)
 * for the third unnamed parameter (whose value is par3)
 * for the first named parameter (whose value is val1)
 * for the first named parameter (whose value is val2)
 * instead of
 * instead of