lu a on sublime text
DESCRIPTION
Lu a on Sublime TextTRANSCRIPT
-
6/8/2014
Running Lua on Sublime Text A step-by-step guide to execute Lua
code on Sublime Text
Stephen Leitnick
-
1
June 8, 2014
First things first, Sublime Text does not have a Run or Execute command built
into it. Instead, it has a Build command, which is set aside to build code.
However, a Build system can easily be used to execute Lua code as well, simply by
executing the code against a Lua binary.
1. Ensure you have Sublime Text installed. In this example, I am using Sublime Text 3
Beta. Pick it up here: http://www.sublimetext.com/
2. Download the Lua Binaries
a. Get the download at: http://luabinaries.sourceforge.net/download.html
b. Download the ZIP file
c. Extract ZIP to your desired path, such as C:\Dev
d. You should now have a directory such as C:\Dev\LuaBinaries
3. Open Sublime Text and navigate to Tools > Build System and click on New Build System...
NOTE: Sublime Text might come with a Lua build system already listed, but it does not do
anything, so creating a new build system is still necessary.
4. A tab will pop up titled untitled.sublime-build. Delete anything present and
add the following code:
{
working_dir: C:\\Dev\\LuaBinaries,
cmd: [lua52, $file]
}
-
2
June 8, 2014
The code should appear as follows, given the working_dir value is set to the
directory that contains the Lua binary files that you have extracted onto your
machine:
5. Save the build system (File > Save or CTRL+S)
a. When you attempt to save, it should open up the directory in which it needs
to save
b. Save as Lua.sublime-build
6. Set the current Build System to Lua:
-
3
June 8, 2014
7. Test it out
a. Create a new File (File > New File or CTRL+N)
b. Save the file as HelloWorld.lua
c. Write a print statement, such as print(Hello world!)
d. Execute code: Press F7 or CTRL+B
e. See the result in the output window (Press ESC to hide the output window)
NOTE: Anytime you want to execute standard Lua code, repeat steps 6 and 7.