如何执行Sublime Text 3中的lua文件? [英] How do you execute a lua file in sublime text 3?

查看:707
本文介绍了如何执行Sublime Text 3中的lua文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何执行sublime文字3中的lua文件?我尝试打开控制台并键入build <filename>.lua.我还浏览了菜单以进行构建和运行.据说保存文件或按 F7 应该可以执行lua脚本,但这也不起作用.我希望保存后控制台中会打印出"helo world",并且它说的就是文件已被写入.

How do you execute a lua file in sublime text 3? I tried opening the console and typing build <filename>.lua. I also looked through the menu's for a build and run. Supposedly saving a file or hitting F7 is supposed to execute lua scripts, but that did not work either. I expected 'helo world' to print in the console upon save and all it said was the file was written.

helo.lua的内容:

contents of helo.lua:

print('helo world');

推荐答案

您可以手动创建Lua的构建配置.但是,我建议安装包含一个Lua软件包比较简单.

You can manually create a build configuration for Lua. However, I suggest that it is simpler to install a Lua package that includes one.

  1. 安装程序包控制
  2. 打开命令面板(在Windows上为Ctrl-Shift-P,在Mac上为COMMAND + SHIFT + P)
  3. 键入"packins"之类的内容以获取"Package Control:安装软件包"项.
  4. 片刻暂停后,将显示可用软件包的列表.键入"Lua"以过滤到Lua软件包.
  5. 我个人最喜欢的是"Lua Dev".选择此程序包,程序包控制"将为您下载并安装该程序包.
  6. 从现在开始,如果将文件的语法设置为Lua(Ctrl-Shift-P,设置语法:Lua",或单击窗口的右下角并选择Lua),则按下F7 (又名Tools-> Build)将使用Lua解释器评估文件.
  1. Install Package Control
  2. Open the Command Palette (Ctrl-Shift-P on Windows or COMMAND + SHIFT + P on Mac)
  3. Type something like "packins" to get the "Package Control: Install Package" item.
  4. After a momentary pause a list of available packages will appear. Type "Lua" to filter to Lua packages.
  5. My personal favorite is "Lua Dev". Select this package and Package Control will download and install the package for you.
  6. From now on, if your have your syntax set to Lua for a file (Ctrl-Shift-P, "Set Syntax: Lua", or click in the bottom right corner of the window and choose Lua) then pressing F7 (aka Tools->Build) will evaluate the file using the Lua interpreter.

您可能还需要安装修复Mac路径" .在撰写本文时,Package Control找不到该程序包.或者,通过在终端中运行以下命令来安装修复Mac路径":

You may also need to install "Fix Mac Path". At the time of this writing this package was not found by Package Control. Alternatively, install "Fix Mac Path" by running the following command in terminal:

git clone https://github.com/int3h/SublimeFixMacPath.git ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/FixMacPath

这篇关于如何执行Sublime Text 3中的lua文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆