StendhalScripting/Lua: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>AntumDeluge
Tables: accessing table values
imported>AntumDeluge
Line 169: Line 169:
Like normal variables, functions can be declared as '''global''' or '''local''' & must be terminated with the <code>end</code> keyword.
Like normal variables, functions can be declared as '''global''' or '''local''' & must be terminated with the <code>end</code> keyword.


There are two ways to declare functions:
There are two ways to define functions with the <code>function</code> keyword:
<pre>
<pre>
local function myFunction()
local function myFunction()
Line 183: Line 183:
</pre>
</pre>


Functions can also be values in a table:
Functions can also be members of a table:
<pre>
<pre>
local myTable = {}
local myTable = {}