我应该使用什么命令从Lua Intepreter启动程序? [英] What command should I be using to launch a program from the Lua Intepreter?
问题描述
我一直在尝试解决如何启动用Lua编写的程序的问题,在我看来,我应该从Lua解释器启动程序.Lua编程的第一版告诉我,我应该使用命令 prompt>.lua hello.lua
.我的程序的名称是"hello.lua",它与解释器位于同一文件夹中,但是在>"附近出现错误消息"=".我应该使用什么命令?还是我做错了什么?
I have been attempting to troubleshoot how to launch a program I write in Lua, and it seems to me that I should be launching the program from the Lua Interpreter. The First Edition of Programming in Lua tells me I should use the command prompt> lua hello.lua
. The name of my program is "hello.lua" and it is in the same folder as the Interpreter but I get the error message '=' expected near '>'. What command should I be using? Or am i doing something wrong?
推荐答案
Windows 下(管理员控制台):
Under Windows (administrator console):
ftype Lua.File=C:\utils\lua.exe "%1" %*
(其中c:\ utils \ lua.exe是您的Lua解释器的实际路径)
(where c:\utils\lua.exe is the actual path of your Lua interpreter)
assoc .lua=Lua.File
现在,您可以在命令提示符下直接输入: hello.lua
Now, you can type: hello.lua directly at the command prompt
并且,如果在计算机/属性/高级/环境变量"(以Win7为例)中将.LUA添加到PATHEXT变量中,则只需在命令提示符下键入: hello ,而无需扩展名.
And, if in "Computer/Properties/Advanced/Environment Variables" (Win7 example) you add .LUA to the PATHEXT variable, you can simply type: hello at the command prompt, without the extension.
这篇关于我应该使用什么命令从Lua Intepreter启动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!