Functions.
Exercises, examples and other material relating to training module U106. This topic is presented on public courses
Learning to program in Lua,
Lua Programming
Lua Programming - Learning to program in Lua and make good use of the language
Our public "Lua Programming" course takes you from the
basics of the language
... http://www.wellho.net/course/ubfull.html [course] |
Learning to program in Lua - Learning to program in Lua and make good use of the language
"Learning to program in Lua" takes you from the basics of
computer ... http://www.wellho.net/course/ulfull.html [course] |
Programming training is much more effective if the delegates are shown how a particular program is written, rather than just the final result ... show ... http://www.wellho.net/mouth/1744_Lua ... urses.html [short article] |
I have presented a bespoke Lua course over the last three days ... and it has lead me to some interesting new examples which I'm sharing here.
Object ... http://www.wellho.net/mouth/2455_Lua ... s-etc.html [short article] |
During some courses, I write few (if any) new examples in front of my delegates, rather relying on the standard ones in the training notes (which I wrote ... http://www.wellho.net/mouth/1699_If- ... mples.html [short article] |
In Lua, the table.sort function allows you to sort a table and by default is sorts into the order that's given back by the < operator on each of the ... http://www.wellho.net/mouth/1697_Sor ... utine.html [short article] |
When you're writing a sort routine, passing in "a" and "b" to be compared, how do you access other data that's needed in association with a and b? If ... http://www.wellho.net/mouth/2312_Wha ... -Lua-.html [short article] |
This topic is presented on public courses
Learning to program in Lua,
Lua Programming
Examples from our training material
| brvret | break v return |
| cl2d | First Closure demonstration |
| dress1 | The problem of default global |
| dress2 | declaring variables local to avoid global issues |
| dress3 | Code loads at run time not compile time |
| ex106 | excersize - functions |
| exrate | exchange rate example as a function |
| fav | Using tables and functions within them |
| fcv | Dynamic code loading |
| fsr | Flexible Function Calls |
| funone | Function calling and definition in Lua |
| funtwo | global, local and call by value |
| isd | An adaptive function in Lua |
| lazy | lazy operators / short circuit evaluation |
| loadthese.lua | functions to include within a test harness |
| lomore | variables local to a block |
| mj | A function to take a lot of parameters or a table |
| owsort | how sorting via callbacks works |
| rmv | returning multiple values |
| size.lua | sample module - exercise answer |
| summer | variable arguments - a function to add up numbers |
| symet | Symetric Functions |
| tabasnamed | function call via table |
| testharness | Loading functions from a file |
| vargs | Variable number of arguments |
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
Defining and calling functions.
Variable scope.
Return values.
Chunks as functions.
Upvalues and Closures.
Variable Argument Lists.
Nesting and passing functions and recursion.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.