Lua: command line parameters null on windows 8.1

I am running a Lua script using the command line:

scipt.lua arg

      

But when I want to print the arg1 value in the script:

print(arg[1])

      

The result is zero.

When I try to run it like:

lua script.lua arg

      

It returns an unrecognized command for windows. What am I doing wrong? How can I get the parameters from the command line?

+3


source to share


1 answer


I don't see any problem with your example. Since you can run this command, but you don't get the arguments passed, it is possible that whatever the script registered the association was not using the syntax for passing arguments. You can search for the registered association and check this command to make sure it includes %*

in order to pass all parameters to the script.



You can find where the executable is running using a command where lua.exe

and then invoke that executable directly from the command line to make sure it works.

+5


source







All Articles