uninformed
uninformed

Reputation: 15

Adding lua.exe to my system path

I've been having difficulty setting up lua as a system path. I'm attempting to run lua programs via the command prompt. I've followed multiple stackoverflow answers for similar questions: Running a lua program from a text file to no avail. Regarding the link's four steps: I'm able to complete step one no problem, would like to complete step three and step two onward have thoroughly confused me.

I've edited my PATH variable to include what I believe the correct path for lua is: C:\Program Files\Lua\5.3.4_64\lua53.exe. I feel like this is where I'm botching it.

This is the general output when I try to run lua from a cmd prompt within the folder holding lua.exe or outside of it.

C:\Program Files\Lua\5.3.4_32>lua main.lua

'lua' is not recognized as an internal or external command, operable program or batch file.

If anyone can help or needs more information to help please let me know and thank you in advance.

Upvotes: 0

Views: 14109

Answers (1)

cyclaminist
cyclaminist

Reputation: 1807

You need to add the folder of lua53.exe to the PATH variable. That is, add C:\Program Files\Lua\5.3.4_64, not C:\Program Files\Lua\5.3.4_64\lua53.exe. Then when you type lua53 in the command prompt, the command processor will search in that folder for lua53.exe and run it.

If you want to run Lua in the command line with the name lua, you will have to rename lua53.exe to lua.exe, or create a batch file named lua.bat with the content lua53 %* and save it in the same folder as lua53.exe. (%* is a variable that copies the arguments that you typed after the name of the batch file. That is, if you type lua -e "print 'Hello, world!'" in the command line, it will execute the command lua53 -e "print 'Hello, world!'".)

Upvotes: 5

Related Questions