Exercises, examples and other material relating to training module U108. This topic is presented on public courses
Learning to program in Lua,
Lua Programming,
Lua Programming
Articles and tips on this subject | updated |
4366 | Changing what operators do on objects - a comparison across different programming languages In Object Oriented languages, you used named pieces of code known as methods to perform an operation on a variable - for example you might write
weeklist.extend(weekend)
to take a list of (something) for a week and add a list relating to weekend onto the end of it.
Sometimes, the method ... | 2014-12-30 (longer) |
3687 | Binary / bitwise operations in Lua with the standard bit32 library If you want to do bit manipulation in Lua, you can use the bit32 library (which is loaded as a table) from Lua 5.2, and it's backported to newer Lua 5.1 versions as well. Bit manipulation is particularly useful in applications where data is packed into a series of bytes - in effect an array of booleans.
Let's ... | 2012-04-06 |
2383 | Lua Regular Expressions OK - don't believe the headline - Lua doesn't support "Regular expressions" but it does have pattern matching. Why? Because Lua is designed to have a small footprint, and a conventional Regular Expression library would be 'bloat' - the pattern matching that's provided looks similar, and offers 80% ... | 2010-06-19 |
2727 | Making a Lua program run more than 10 times faster I made an extraordinary claim on Thursday. One of my delegates had written a program that analyzed a huge data file in a Lua script, and it was taking over half an hour to run. "Give me five minutes, and I could have that running in less that five minutes" I claimed.
It was all to do with pattern ... | 2010-05-14 |
2702 | First and last match with Regular Expressions Conventional Wisdom says that it's pointless to start a regular expression with ".*" or ".+", as this is implied within a match - regular expression matches are looking for strings that are contained anyway:
'/abc/' - contains abc
'/.*abc/' - contains anything or nothing, followed by abc
However - ... | 2010-04-02 |
1847 | Lua - IAQ (Infrequently Answered Questions) Here are a handful of "one line" answers from the end of the Lua Course I was running at the end of last week
• Command line parameters in Lua are available to the program in an indexed table called arg. (Sample Program)
• Functions in Lua can look at the number and type of parameters they're ... | 2008-11-02 |
1744 | Lua examples, Lua Courses Programming training is much more effective if the delegates are shown how a particular program is written, rather than just the final result ... show them just the final result and they'll ask "but how did you come up with that?"
So whenever possible, I write new examples in front of my delegates - ... | 2008-08-09 |
Examples from our training material
dls | Pattern substitute, pattern match and extract |
iiapc | Pattern matching in Lua (not Regular Expressions) |
lpm | Anchoring and delimiting patterns |
patplode | iterating through a string, choosing a pattern |
pcis | Pattern match and extract - a postcode |
slander0 | Pattern matching - SLOW code |
slander1 | Pattern matching - FAST code |
split | split or explode in Lua |
stratch | String Pattern Matching |
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
[here].
Topics covered in this module
Anchors, literal characters, counts and groups.
Capturing matchs, capturing all the matches (global)
Pattern Based functions.
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
Ruby,
Lua,
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.