Sticking to my plans, I’ve begun teaching myself Lua. Although it’s a bit odd to wrap my head around after just diving head-first into C++, it’s pretty cool!
One lesson I’ve learned (or, rather, had reaffirmed) is how important writing clean code is. Given Lua doesn’t require semicolons to separate statements and doesn’t use braces, you can get away with some really sloppy, hard-to-read stuff. The following are all equivalent:
-- Easy to read factorial function function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end
-- Hard to read, but simple enough where you could probably figure it out function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end
-- Oh boy. function fact (n) if n == 0 then return 1 else return n * fact(n -1) end end
Having only really worked with C#, C++, Java, and ActionScript, it’s going to take some effort getting used to the syntax of Lua; however, I’m up for the challenge!