Compile using Terminal in Lua

Asked

Viewed 854 times

3

I’m starting now the programming language studies Lua, but I’m having a hard time when I do a program in c to compile the algorithm in the terminal I write:

**gcc nome-do-programa.c** and then I put **./a.out**

and it brings a value or something like it depends on what is being asked, in moon I must write program-name moon and "should do what my script is asking and bring the result", but not and what it brings feel that something is missing.

  • Raiane: Can you edit the question and put the moon code you are trying to execute? I believe it gets easier to try to help

1 answer

1

./a.out x y z

receives the strings "x", "y", "z" in argv, beginning in argv[1].

This works exactly the same way in Lua:

lua myscript.lua x y z

receives the strings "x", "y", "z" in arg, beginning in arg[1].

Note that it is arg in Lua, no argv.

  • vararg also does not have this functionality no? ...

Browser other questions tagged

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