Wednesday, July 16, 2014

My first attempt at learning LUA

Our new, enhanced "Services" application.
Every journey begins with a little step and, well, I believe I just made one of those little steps. When I was younger than today (much younger, I was actually a child) I could find on the shelves a lot of magazines full of BASIC programs for Commodore's and other 8-bit computers that users were expected to type back on the keyboard, save on tape and run. Like almost everybody else at the time, in the beginning I couldn't really figure out what those cryptic commands, written in a language I didn't speak, could do. But when you're young you're plenty of time and will, so I started experimenting: cutting parts of the scripts to understand what they did, make little changes to notice the differences at run time... months later, I had mastered BASIC enough to adapt programs I was interested in and port them, from instace, from the Commodore 64 to my really unluck Commodore 16. For many reasons, however, in the meanwhile I stopped coding (and learning to) because I had less time, then I started a work, I joint a family and so on. But this is not the interesting part.

The interesting news is that I finally had a little spare time, and I decided to look at "Services" LUA script. Services is the programs in /Prefs which allows to configure things Icaros will launch at startup, like Opaque, VNC and FTP servers, AmiBridge and so on. I needed to modify it to support multiple GUIs (Wanderer and Magellan) and automatic shell (a feature I've been required to add by Magorium, which will run the AROS shell at startup), but I didn't want to bug Yannick for modifications that should be really trivial for a Lua expert (and somehow compelling for a beginner like me). So I gave a look myself and incredibly discovered that I was actually able to follow the program logic even without knowing anything about the language. So I started copying parts of code and modify them, comment out unwanted things and... well, the result is depicted in the upper screenshot. Now we can choose GUI and enable/disable shell without that ugly "GUI Choice" script (which was also severely bugged, as Neil Cafferkey reported to me...). Since "Services" is going to manage more settings in the future, I guess its name has to change somehow. I will run a little survey on Icaros' Facebook page for that, se please follow us if haven't yet!