Training, Open Source computer languages

PerlPythonMySQLTclRubyC & C++LuaJavaTomcatPHPhttpdLinux

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Quiz Page lua
The lua quiz has changed! We have replaced lua questions with answers! And from those answers you'll find further links to even more information - forums where you can ask questions, training courses, longer articles, and more. [link to quiz index] ... If you really want the old quiz questions, you can find them here, here, here and here ... and with onward links to the possible answers to each question too.

A life lesson from the accuracy of numbers in Excel and Lua
Floating point numbers aren't held EXACTLY in a computer's memory - they're held to a certain accuracy (number of significant figures or binary digits to be more accurante) after which they are ...

Dynamically 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 ...

Lua Classes - open enrolement
Advert - Extra Course! I've just scheduled an extra Lua course - running from 19th (Thursday) to 22nd (Sunday) of November, on Lua. It's "last minute" which means that the group of delegates will be ...

Luac - getting lua to start fast by precompiling
Luac is Lua's Compiler ... using "luac" you can turn your Lua program into a binary (executable) file. Covered on Installing Lua on our Lua Programming and Learning to program in Lua courses. usage: ...

Lua examples - coroutines, error handling, objects, etc
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 Orientation is more a way of thinking and coding ...

For loops in Lua
As an old Fortran programmer, I remember that a for loop was given a start point, an end point and a step ... and they had to be whole numbers (integers). Lua's for loops can be used that way, but ...

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 ...

Error Handling in Lua with assert and pcall
When a function fails in lua, you'll often find that it return a nil value that you can check, or it returns two values, the second of which is an error status / message that tells you what went ...

A fresh example - objects the Lua way
One of the requirements we often have in our web server log file analyses is to connect together a series of accesses from a single IP address into a "visit", and this formed an example on Tuesday's ...

Encapsulating shared code in a Lua module
Have you ever written code like this? seps = {" "," "," [",'] "','" '," ",' "','" "','"'} Yes, I have ... in fact, that's code that I wrote on Tuesday during the Lua course; it's an indexed table of ...

Checking 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. ...

Passing multiple results back from a function - Lua, Python, etc
Have you ever wondered why you can pass in as many parameters as you like to a function, but only return one? It seems rather unfair, doesn't it - especially as you may have lots of results. In ...

Ternary operators alternatives - Perl and Lua lazy operators
"If the gender is male, the answer is him, but if the gender is female, the answer is her". A common situation in programming - [is/are], [him/her], [yes/no], [child/children], [ice/water/steam], ...

Finding 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 ...

Dot, dot, dot in Lua - variable length parameter lists
Lua functions can take any number of parameters - the ... (dot,dot,dot) table given as a parameter 'soaking up' all remaining parameters into the indexed section of the table, rather this "*" in front ...

The indexed and hashed parts of a Lua table
A Lua table contains both a sequentially indexed section and a hash keyed section (and a few other things too). When you sort the table, you sort only the index keyed section, when you use ipairs you ...

Automatically initialising Lua variables the first time
In Lua, you need to initialise variables before you perform arithmetic on them, but you CAN test them (and if they don't exist, they will return false). For example, this code initialises a variable ...

Reading a data file and sensing EOF in Lua
In Lua, the standard table io includes an io.open code element that lets you open a file. This returns a userdata to you (looks like a table but isn't - it's a C accessible structure) from which you ...

Certification Revisted - Lua
I happened upon a "should you be certified" thread relating to Lua while browsing for quite other Lua topics ... it's here, and the initial post appears to provide a reasonable, if admittedly tilted, ...

Graphics in Lua - an example using the gd library
In answer to the question "how would you generate graphics from Lua?" ... I would (personally) look at a binding to the gd library - http://luaforge.net/projects/lua-gd/ - as this is an excellent ...

For Lua Programmers AND for Town Planners
I'm always happy to be able to make multiple use of the same piece of work, and so it is with an example written last week. READ THIS SIDE ... if you are a Lua or game programmer I was asked to ...

New Lua Examples - for last weeks delegates
When I train you, I promise that when I leave (an onsite course) or you leave (a course at Well House Manor), that won't be the last you hear or see of me if you wish for further help. For the Lua ...

Passing parameters to a coroutine in Lua
Lua's coroutines, like Python's generators, provide for something which is akin to lightweight threading - rather than a strict functional calling stack, where one function must be completed before ...

What are closures in Lua?
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 - for example - a and b are keys to a hash or ...

Learning to write high quality code in Lua
What a wonderful opportunity this week - to train delegates in Lua programming (and Lua, byte for byte, is perhaps the best value language that I train in) but also to be in on the early stages of a ...

Lua training class in Spanish
"Can't wait to hear how you're getting on". "Keeping an eye on your blog". A couple of messages from folks wondering how I'm getting on with my Lua course in Guadalajara, Mexico, this week. The ...

Handling nasty characters - Perl, PHP, Python, Tcl, Lua
Are your writing or maintaining a web based application that uses forms? If so, you have better be aware of some of the nasty characters that are around! The < character, when echoed back from a ...

Learning PHP, Ruby, Lua and Python - upcoming courses
The following programming courses are all booking well, but still have good availability: PHP - starting 6th July Ruby - starting 14th July Lua - starting 10th August Python - starting 17th August ...

RT @brento - a valuable source for the twitter newbie
So I'm new(ish) on Twitter ... what do those @ symbols and things like RT and OT mean? Brent Ozar explains in his blog, and also tells us why people follow and why people don't follow. OK - I'm ...

Learning to program in PHP, Python, Java or Lua ...
... or in Ruby, Tcl, C, C++ or Perl Are you new to computer programming? Is it so long since you programmed that you feel very rusty and would like to start again from basics? If you've said "yes" to ...

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 ...

Passing a table from Lua into C
In a previous article, I showed you a simple example of how you can call a function that's written in C from Lua, and a second example that extended that - passing simple parameters in to the C ...

Calling functions in C from your Lua script - a first HowTo
This short article shows you how to call a function that's written in C from a program written in Lua, how to write the function that's called, and how to turn it into an appropriate library and load ...

Lua Course, and the Wiltshire Countryside too
With courses such as Lua Programming, our delegates come from far and wide - it's very much a niche subject, and that's why we provide facilities that are a little different to most training ...

Formatting with a leading + / Lua and Perl
In formatted printing, you can often use a leading "+" in the format string to force a positive sign to be added in front of positive numbers - for example "%+4d" means an integer, to base 10, 4 ...

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 ...

First class functions in Lua lead to powerful OO facilities
"In Lua, function names are first class variables." Ok - so what does that mean? At the most direct / simplest, it means that a function can be stored in a variable - so that you can write ...

Lua - Table elements v table as a whole
Lua ... If you refer to a table name WITHOUT square brackets, you are referring to (and will effect) the whole table ... but if you refer to a table name and put something thereafter in square ...

Clean code, jump free (Example in Lua)
The "goto" statement - in languages that still support it - is regarded with disdain by Computer Scientists as it makes for spaghetti code - hard to follow and going all over the place! In some ways, ...

Rules, suggestions, considerations for Lua variable names
Rules for naming variables in Lua ... * MUST start with a letter or underscore * which MUST be followed by as many or as few letters, digits, underscores as you like * Case sensitive (sound bite - ...


You can Add a comment or ranking to this page

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