Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python, Lua, Tcl, C and C++ training - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, Ruby, MySQL and Linux / Tomcat systems
 
If you are learning Lua, here are some more examples

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 anyway!) and making small changes and adjustments to illustrate how things work. On other courses, though, I write a some new examples from scratch - and such was the case during last Thurday and Friday's two day Lua training class.

Here - primarily for the delagates in that class - are links to the many of the new examples, which I have added to our on line resource. If you follow the links to any of these, you'll be offered links to other related examples too!

Lua Fundamentals

Comments in Lus
Simple sting.format example
for loop example in Lua
strip.rep to repeat a string
getting the minimum value from a table in Lua
Pattern Matching -getting names from amongst a stream of punctuation

Lua functions and modules

Variable number of arguments to a function
Lua functions to return larger of two values and largest of a table of values
How sorting works in Lua - looking under the counter
A Lua program that calls in a module and the module itself
An function which could usefully be turned into a coroutine and that example amended to run as a coroutine

Towards Object Orientation in Lua

A reminder of tables
Adding Lusa's metables to change functionallity
Creating and using a table of Lua 'objects'
Redefining operator behaviour on tables in Lua

Lua is a really excellent language with a small "footprint" - the more I use it, the more I like it (and I like it a lot!). You won't find the "bloat" of other open source languages, but you WILL find nifty and useful features which come together to make it a very valuable programming tool; it's this feature set that has led to its widespead adoption in the games industry where (for example) it's used in "The world or Warcraft" to customise the user interface.
(written 2008-07-06, updated 2008-08-05)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
U101 - Introduction to Lua.
  [4324] Learning to program - variables and constants - (2014-11-22)
  [4271] Line, block and nested comments - Lua compared to other languages - (2014-05-04)
  [3724] Learning to Program in Lua - public / open training course / class - (2012-05-09)
  [2310] Learning to write high quality code in Lua - (2009-07-30)
  [1842] Lua Course, and the Wiltshire Countryside too - (2008-10-16)
  [1737] Rules, suggestions, considerations for Lua variable names - (2008-08-05)
  [1695] Lua Course - here is the index - (2008-07-03)
  [1111] Training in Lua - (2007-03-16)

U102 - Lua - Numbers and the Math library.
  [4569] Lua - changes to how integers and floats are handled - 5.2 to 5.3 - (2015-11-02)
  [3917] BODMAS - the order a computer evaluates arithmetic expressions - (2012-11-09)
  [2509] A life lesson from the accuracy of numbers in Excel and Lua - (2009-11-21)
  [2345] Automatically initialising Lua variables the first time - (2009-08-10)
  [1744] Lua examples, Lua Courses - (2008-08-08)

U106 - Lua - Functions.
  [3695] Functions are first class variables in Lua and Python - (2012-04-13)
  [2949] Lua - variable function arguments and select - (2010-09-08)
  [2723] Returning multiple values from a function - Lua - (2010-04-15)
  [2455] Lua examples - coroutines, error handling, objects, etc - (2009-10-15)
  [2356] Passing multiple results back from a function - Lua, Python, etc - (2009-08-13)
  [2347] Dot, dot, dot in Lua - variable length parameter lists - (2009-08-11)
  [2312] What are closures in Lua? - (2009-07-31)
  [1847] Lua - IAQ (Infrequently Answered Questions) - (2008-10-18)
  [1743] First class functions in Lua lead to powerful OO facilities - (2008-08-07)
  [1697] Sorting in lua - specifying your own sort routine - (2008-07-05)
  [1685] Short circuit evaluation (lazy operator) in Lua - (2008-06-22)

U107 - Object Orientation - the Lua way
  [4753] Lua, Tcl, Python, C and C++ courses - at our Melksham HQ or on your site - forward from July 2017 - (2017-07-02)
  [4573] Classic style OO code - in Lua - (2015-11-05)
  [4572] Tables with values and code in Lua - looks like an object? - (2015-11-05)
  [4273] Dot or Colon separator between table name and member in Lua - what is the difference? - (2014-05-06)
  [4248] Metatables, Metamethods, classes and objects in Lua - (2014-03-18)
  [4117] Is Lua an Object Oriented language? - (2013-06-15)
  [3730] What is a metatable? How do I set one up? How do I use them? Lua - (2012-05-12)
  [3727] Using Lua tables as objects - (2012-05-11)
  [3694] Special __ methods you can use in Lua metatables - (2012-04-12)
  [3683] Weak references in Lua - what are they, and why use them? - (2012-04-04)
  [3524] Metaclasses (Python) and Metatables (Lua) - (2011-11-17)
  [3396] Tables as Objects in Lua - a gentle introduction to data driven programming - (2011-08-17)
  [3142] Private and Public - and things between - (2011-01-22)
  [2710] __index and __newindex in Lua - metatable methods - (2010-04-05)
  [2703] Lua Metatables - (2010-04-02)
  [2701] Is Lua an Object Oriented language? - (2010-04-01)
  [2359] A fresh example - objects the Lua way - (2009-08-13)
  [2318] For Lua Programmers AND for Town Planners - (2009-08-02)
  [1819] Calling base class constructors - (2008-10-03)
  [1692] Towards Object Oriented Programming in Lua - (2008-06-30)

U109 - Lua - Modules
  [4571] Lua - using modules to add your own utilities - (2015-11-04)
  [2358] Encapsulating shared code in a Lua module - (2009-08-13)

U114 - Lua - Threading and Coroutines.
  [4270] Embedding Lua to perform tailored code at an interval - (2014-05-03)
  [3395] Parallel but not really parallel. Moving game characters. Coroutines in Lua. - (2011-08-17)
  [2314] Passing parameters to a coroutine in Lua - (2009-08-01)
  [1870] What to do with a huge crop of apples - (2008-11-04)
  [1691] Co-routines in Lua - co-operative processing - (2008-06-29)


Back to
Dealing with The Press
Previous and next
or
Horse's mouth home
Forward to
FTP server on Fedora Linux
Some other Articles
Perl ... adding to a list - end, middle, start
Running operating system commands in Perl
Training Course and Business Conference Technology
FTP server on Fedora Linux
If you are learning Lua, here are some more examples
Dealing with The Press
Saying NOT in Perl, PHP, Python, Lua ...
Defensive coding techniques in PHP?
4755 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2017: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1699_If- ... mples.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat