简体   繁体   English

设置在'Lua for windows'中运行文件的路径

[英]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. 我的问题是:我正在努力学习如何在Lua中编程来制作魔兽世界的附加组件。 I bought 'Programming in Lua- by Roberto Ierusalimschy, 3rd edition' to teach myself the language. 我买了“罗伯托Ierusalimschy的Lua编程,第3版”来自学语言。 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) 下载“Lua for windows”以执行本书中的示例后,我无法弄清楚如何从命令窗口调用文件(我可以在SciTE中编写程序并运行它,它将在该程序的底部窗口中运行,但是这不是我想做的事情)

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.lua to run the file, but I am getting the following error. 例如,如果我将.lua文件保存在名为hello.lua的某个文件夹中, hello.lua这本书告诉我我可以输入% lua hello.lua来运行该文件,但是我收到以下错误。

stdin:1: unexpected symbol near'%' stdin:1:'%'附近的意外符号

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? 是否有一个默认文件夹,它没有告诉我,我应该保存我的所有程序?

In the book 在书里

% lua hello.lua

The % is supposed to be the prompt in Unix-like systems. %应该是类Unix系统中的提示。 In Windows, if you are already in the current path of the file in the command line, you can simply type: 在Windows中,如果您已经在命令行中的文件的当前路径中,则只需键入:

lua hello.lua

在此输入图像描述

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. 请注意,PiL书的第3版是关于Lua 5.2的,但是当前的Lua-for-windows是版本5.1.4(您可以运行lua -v来确认。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM