Sunday, October 28, 2012

A gotcha and a gripe

Gripe first.

Once again, need to learn a 'new' way to concatenate strings.

One would think such a common programming task would be easily done regardless of language. 

One of course would be wrong.

Lua furrowed new ground for me here - no pipes, no use of the ampersand or the plus sign.  No sir!  Instead Lua uses two dots to indicate the concatenation of two stringvalues.  Go figure.

Lua concatenation: string3 = string1..string2

Gotcha next - spent some time trying to figure this one out. Kept getting an obscure error.  I was calling a function in another file - had the proper initializing statement in the file trying to use the function:

requires ( "filename" )
 
Instead of using the name space idea common to Java or .NET, Lua has you put this line into your functions:
 
module(..., package.seeall);
 
Added that as a line to my two new files and no more errors.

No comments:

Post a Comment