Hello World in LuaPublished on 01 November 2018 (Updated: 09 November 2018)
In this article, we’ll be tackling Hello World in Lua, a high performance scripting language.
How to Implement the Solution
At any rate, let’s get down to business:
As we’ll quickly notice, Hello World in Lua is not that exciting. In fact, there are only a handful of languages with this boring of an implementation. For instance, both Ruby and Python can perform Hello World in a similar fashion. As a result, there’s not a ton of explaining that needs to be done.
Essentially, Lua has a native printing function which can be used to write a string to stdout. In this case, it’s called print, but the developers could have just as easily called it put, write, println, or puts. If you know of any other fun print function names, let me know in the comments.
As usual, we pass a string to the print function, and the function handles the rest.1
How to Run the Solution
Well, perhaps running the script will be more interesting. Fortunately for us, there’s an online REPL for Lua, so we don’t have to worry about downloading anything. Once inside, drop the code snippet from above into the editor and hit run. That’s it!
Alternatively, we could download a copy of Lua, and run the solution locally. Even better, we could build a Docker image, so we don’t clutter our machine with dependencies. If you want to help with the Docker initiative, head on over to the Sample Programs repository and fork it. We appreciate the help!1
J. Grifski, “Hello World in Lua,” The Renegade Coder, 28-Jul-2018. [Online]. Available: https://therenegadecoder.com/code/hello-world-in-lua/. [Accessed: 31-Oct-2018]. ↩ ↩2