user2977554
user2977554

Reputation: 43

Setting path to run files in 'Lua for windows'

My question is this: I am trying to learn how to program in Lua to make Addons for World of Warcraft. I bought 'Programming in Lua- by Roberto Ierusalimschy, 3rd edition' to teach myself the language. After downloading 'Lua for windows' to perform the examples in the book I cannot figure out how to call files from the command window (I can write a program in SciTE and run it and it will run in the bottom window of that program, but that's not what I am trying to do)

For example if I have a .lua file saved in a folder somewhere called hello.lua the book is telling me I can just type % lua hello.luato run the file, but I am getting the following error.

stdin:1: unexpected symbol near'%'

I am guessing this is because I have not told it what folder to look for this file in, but I cannot figure out how to tell it which file to look in. Any suggestions?

Is there a default folder somewhere that it has not told me about that I am supposed to save all of my programs to?

Upvotes: 4

Views: 1848

Answers (1)

Yu Hao
Yu Hao

Reputation: 122403

In the book

% lua hello.lua

The % is supposed to be the prompt in Unix-like systems. In Windows, if you are already in the current path of the file in the command line, you can simply type:

lua hello.lua

enter image description here

Note that the 3rd edition of the PiL book is about Lua 5.2, but the current Lua-for-windows is version 5.1.4 (You can run lua -v to confirm.

Upvotes: 5

Related Questions