Execute code in Lua language

Asked

Viewed 661 times

4

I downloaded the Lua language interpreter, created a file hello.lua with the code below:

print("Hello World")

But I can’t compile this code and display the output. I downloaded version 5.3.3 and ran the file lua.exe, the console is displayed and typed: lua hello.lua, but the error below is presented:

interpretador Lua

Detail, the execution of direct code on the console works, ie if I type print("hello world") the return is hello world. But what I want is to run through a file.

2 answers

6


  • It worked with dofile. But I tried outside the interpreter and could not. What is the correct installer for the command to be recognized?

  • 1

    There is no correct installer, if you have everything there it is to work, but that is another problem. See: https://www.lua.org/download.html

1

If it happens to someone in the future, just put the version after the moon command.

The posted version is 5.3.3, then the right thing would be to put lua53

Example:

lua53 hello.lua

Browser other questions tagged

You are not signed in. Login or sign up in order to post.