Setting the path to run files in 'Lua for windows'

My question is this: I'm trying to learn how to program in Lua to make Addons for World of Warcraft. I bought "Programming at Lua-Roberto Ierusalimschy 3rd Edition" to teach myself the language. After downloading “Lua for windows” to run the examples in the book, I can’t understand how to call files from the command line (I can write a program in SciTE and run it, and it will work in the bottom window of this program, but this is not what I'm trying to do)

For example, if I have a .lua file stored in a folder somewhere with a name hello.lua, the book says that I can simply type % lua hello.luato run the file, but I get the following error.

stdin: 1: unexpected character around '%'

I assume that this is because I did not say which folder to look for this file, but I cannot figure out how to say which file to look for it in. Any suggestions?

Is there a default folder somewhere that it did not tell me that I should save all my programs?

+4
source share
1 answer

In the book

% lua hello.lua

This is supposed to %be an invitation on Unix-like systems. On Windows, if you are already in the current file path on the command line, you can simply enter:

lua hello.lua

enter image description here

Note that the 3rd edition of the PiL book refers to Lua 5.2, but the current Lua-for-windows is version 5.1.4 (you can run it lua -vfor confirmation.

+5
source

All Articles