Lua: Hello World!

3 Jul 2016
Karthik Padmanabhan
211
0

So, today we are going to learn our first Lua Program. Yes! You have guessed it correctly. It’s the “Hello World” program.

We have already installed the required Interpreter for Compiling and Executing Lua code on out machine. (Refer: Programming in Lua)

  1. Open Visual Studio Code and create a new file.
  2. Lua uses the print(...) to output text to the console. So, we are gonna write print("Hello World") This will output a string “Hello World” onto the console.
  3. Save the program with the filename extension as .lua to your desired folder path.
  4. Open a command window in the folder path and type lua <filename.lua> and hit return to compile and execute the program.
  5. You have successfully written the first Lua Program.

You will see the following result in your command windows.

Capture001

Leave a Reply

Your email address will not be published. Required fields are marked *