Hello World in Lua

Published on 19 April 2018 (Updated: 15 May 2023)

Welcome to the Hello World in Lua page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

print("Hello, World!")

Hello World in Lua was written by:

This article was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

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.

As usual, we pass a string to the print function, and the function handles the rest.

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!