Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Lua module U104
Strings and the String library.
Exercises, examples and other material relating to training module U104. This topic is presented on public courses Learning to program in Lua, Lua Programming, Lua Programming




Articles and tips on this subjectupdated
4274String formatting in Lua - string.format as a wrapper for sprintf
Lua is a small language - and so for some elements of its functionallity it uses wrappers around underlying C functions rather than re-implementing and duplicating logic. A good example is the string.format function which in essence is a wrapper around sprintf. For example:   thing = string.format("> ...
2014-05-07
 
2500Dynamically formatting your results (Lua)
Scenario: You're producing a short (text) table of results and you want to keep it reasonably small - not a great deal of white space, but the data in some of your columns differs dramatically from one set of results to another. How can you do it? Discussion: You can use your traditional "printf" ...
2009-11-11
 
2357Checking if the user has entered a number (Lua)
In Lua, there's a difference between 0 and nil - and that means that you can easily code to ask your user to enter a number, testing the result and allowing him to enter zero as a legitimate value. That may sound like it's no big deal, but you don't want a loop to exit on a premature 0. Here's code ...
2009-08-14
 
2348Finding literals rather than patterns in Lua
Lua's string.find looks for a PATTERN ... it's not as big an sophisticated as a regular expression match (but then it's got nothing like as big a footprint!), but neither is it a literal match. So if I want to search a string for - literally - a ".", I need to protect it. I can do this either with ...
2009-08-11
 
1744Lua 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
ee   Excercise to print out exchange rate table
gimme   Reading from the keyboard and string basics
kiddos   Spread money gift around a group of children
kids   String formatting
mlx   Single and multiline strings
moopark   Answer to excercise - Theme park takings
qbs   backslash specials in character strings and other basics
s2   Finding literal strings
sf   string.format
splitter   Using string.find and string.sub to split
stem   Basic String functionality
three   Wait until a NUMBER has been entered
two   Checking a NUMBER has been entered
ul   Use of string.rep
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
Double and single quotes, square brackets and backslashes.
String concat, length, etc
Formatting numbers in to strings.
String Conversion 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.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/U104.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb