TableMaster is a SmartASK

As I mentioned in the last post about the new .ASK command, I hadn’t settled on how I was going to handle variable types. There were a number of alternatives, including separate commands, but I finally settled on having .ASK check to see if the user’s input is valid for the variable type given, whether it’s text or numeric.

That, of course, led to the question of what happens if you want to do that at some other time, not just with an .ASK. The answer to that is probably indicative of why TBL, at last count, has 83 commands and another 64 synonyms for some of those commands: I keep thinking of things that should have a command, so I put one in. In this case, it’s .CONVERT.

Also, there’s a new they-variable. More after the jump.

On the plus side, it’s fun to have your own programming language where, if you need a feature, you can add it; on the minus side, it’s going to be a bit tricky getting everything to fit in the manual. .CONVERT is one of those things I put in because it might come in handy.

Usage is simple:

.CONVERT {textvar} TO {numbervar}

Naturally, whatever is in the textvar needs to be a valid number, or TableMaster will complain bitterly — or at least give error messages. It does basically the same thing that happens with input to .ASK, checking to see if the content of the first variable is a valid number and, if so, turning it into a numeric value and putting it in the second. This is probably not something you’re going to need all that often, but if you need it, it’s there now.

I realized there was also something missing in the “they-variables” — the system variables like {$them}, etc., which automatically change to him/her/them as {$sex} changes: there was no one for children. So now there is: {$child}, which switches between child, boy, girl, and children as appropriate. That really should be {$children}, but I decided it made more sense to parallel {$person}; maybe some day in the figure I’ll add the ability to have aliases for variables, and allow {$people} and {$children}.

The new version, with all the improvements I’ve been mentioning over the past few months, will be in the box at MegaMooseCon, which is August 4-6 in Richberg, SC. Stop by the Wintertree table and get a cookie!