How do you execute the lua file in sublime text 3?

How do you execute the lua file in sublime text 3? I tried opening the console and typed build <filename>.lua . I also looked at the menus for build and run. Presumably saving the file or pressing F7 should execute lua scripts, but that didn't work either. I was expecting "helo world" to print in the console after saving, and everything that was said was written.

helo.lua content:

 print('helo world'); 
+6
source share
2 answers

You can manually create an assembly configuration for Lua. However, I suggest that it is easier to install the Lua package, which includes one.

  • Install package management
  • Open the command palette (Ctrl-Shift-P on Windows or COMMAND + SHIFT + P on Mac)
  • Type something like "packins" to get the "Package Control: Install Package" element.
  • After an instant pause, a list of available packages will appear. Enter "Lua" to filter Lua packages.
  • My personal favorite is Lua Dev. Select this package and Package Control will download and install the package for you.
  • Now, if your syntax is set to Lua for the file (Ctrl-Shift-P, "Set Syntax: Lua" or click in the lower right corner of the window and select Lua), then pressing F7 (aka Tools-> Build) will evaluate the file using Lua interpreter.

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

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

Go to Tools> Build System> New Build System.

Paste this code

 { "cmd": ["lua", "$file"], "file_regex": "^lua: (...*?):([0-9]*):?([0-9]*)", "selector": "source.lua" } 

Save it as lua.sublime-build

To start the lua program, press ctrl + B.

PS: Make sure the lua executable is in you $ PATH

+6
source

Source: https://habr.com/ru/post/981769/


All Articles