Its been a while I learnt a new programming language. I have been very happy with Python. All most all the work that I do involves Python. But there has been an itch to learn something new. So I made up my mind to learn a new programming language this week. But again which one? There were quite a few eligible languages to choose from
- Rust is a systems programming language that runs blazingly fast, prevents almost all crashes, and eliminates data races.
- Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
- Haskell is an advanced purely-functional programming language. An open-source product of more than twenty years of cutting-edge research, it allows rapid development of robust, concise, correct software.
- Lua is a powerful, fast, lightweight, embeddable scripting language.
I choose Lua because it suited my present toolkit very well. I am a duct tape programmer. I follow simple logic of first make it work, then make it fast and at last make it beautiful. All my tools have to fit this logic. I think Lua was a much better fit than others.
Lua is probably the best ducttape programmer’s language. Its has simple and limited procedural syntax which is easy to learn. It has small foot print and runs on all platforms including some micro controllers. It can run independently and also inside other programming languages. Its actually this embedding feature that attracted me.
Also the fact that its extremely fast when LuaJIT is used. Lua by itself is simple and limited but there are enough libraries to launch your projects quickly. Bonus points for the fact that both Redis and Nmap the tools that I use often use Lua as their scripting language. So everything I wanted. The second best was Haskell. One day I will go back and learn a fully functional programming language like Haskell.
Lua today is mostly used in gaming world as a script customize games or as an embedded language in other softwares like Redis or Nmap. Even though the community of Lua programmers is small, they are very passionate. I found enough help online to learn and become productive. Some of the resources that I used are
Learning by doing:
For a long time I wanted a programming scratchpad. The idea is you go a website, login, edit/create a page with code, save and get an url for that page so you can run. Somewhat like JSfiddle but much simpler and stronger. Most of my use-cases were that of web-hooks. For example, receive a push from web-hook, process it and post it to some other service. The only service that came close to satisfying my requirements was WebScript. I used their paid account for a while but was not completely happy with the services I was getting for the money.
While learning Lua, I figured I could do that myself. I would use Python as the host language and Lua as the embedded scripting language. Idea included using Django as the framework to give me hosting environment, use lupa to run Lua inside Python. Like always I searched if someone else has done it. It may not be exact but I found AirScript which almost does the same thing. Well its easy to improve than start from the scratch right? After some effort I got it running. Here is my helloworld scratch pad. I will write about it in detail in the next post.
Its been good two weeks after a good vacation and before next one :)