Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

contents of helo.lua:

print('helo world');
like image 634
P.Brian.Mackey Avatar asked Jan 30 '15 14:01

P.Brian.Mackey


People also ask

Can Sublime Text run lua?

I was wondering to start scripting lua in Sublime and need to know know is it possible to execute lua in any way in the Sublime text app? Sure you can. Just install the Lua Dev package. Of course you'll also need to have Lua installed on your system too though.

How do I run a lua script?

To run a Lua scriptOpen the Lua Script Library through Prepare > Run Lua Script. Use the appearing dialog to load, save, and execute Lua scripts as well as to create new ones. Select the script to be run. Click Execute Script.

What do I do with a lua file?

Lua is used for various purposes, including scripting in applications or on the web, programming games, and adding extensions to databases. Some examples of real-world use of Lua include the customization of World of Warcraft and Dawn of War video games and the programming of the Adobe Lightroom app user interface.


1 Answers

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. 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.

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
like image 178
Phrogz Avatar answered Sep 22 '22 22:09

Phrogz