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

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');

You can manually create a build configuration for Lua. However, I suggest that it is simpler to install a Lua package that includes one.
Install Package Control
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" item.
After a momentary pause a list of available packages will appear. Type "Lua" to filter to Lua packages.
My personal favorite is "Lua Dev". Select this package and Package Control will download and install the package for you.
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

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 run a lua program press ctrl+B.
PS: Ensure that lua executable is in you $PATH

Related

How to get LUA to work in VSCode so it runs to the output window?

I installed LUA by following this guide: http://lua-users.org/wiki/BuildingLuaInWindowsForNewbies
I put LUA in Program Files(x86)>lua>5.3.5
If i open up a terminal and type 'lua' it works.
If i create a file called hello.lua with print("Hello, World!") in it, how do i run this file so it comes up in the output window of VSCode?
If i try 'start without debugging' nothing happens'. If i Terminal>Run active file/selected text, the VS terminal window says
'print("hello, world!")
Unable to initialize device PRN'
I've obviously missed something simple but i just don't see a way to run this file to the output window, and an hour hunting through the docs and i'm none the wiser. My only other experience is with VS Community where it's just CTRL+Shift+B to complile and ALt+A to run.
Anyone help?
Thanks.
The Code Runner extension supports Lua, so you can press Ctrl-Alt-N to run the current script file. If it complains about not being able to find the executable, add this to your user settings:
"code-runner.executorMap": {
"lua": "C:\\Program Files (x86)\\lua\\5.3.5\\bin\\lua.exe"
}
Install the extension "Code Runner" in VS Code;
Click the gear icon and open the "Extension Settings";
Search for "Code-runner: Executor Map";
Go into setting.json to update the directory of the installed lua.exe.
"code-runner.executorMap": {
"lua": "\"C:\\Program Files\\Lua\\lua.exe\"",
}
Do not forget to add \" before and end of the directory.

How do I run a Lua script on fceux on Mac os?

First I start the emulator.
Then I load dragon warrior ROM.
Then I try to access the lua script menu.
However fceux will not let me access the main menus anymore. I can only control the emulator.
What is the right way to run a Lua script in version 2.2.3?
The documentation below is obviously lacking. No window pops up. See the **** there is no run Lua script option.
The fceux docs say this:
To run a Lua script, choose "Run Lua Script" from where  In the dialog that pops up, click "Browse" and find the file you wish to run.  This will insert the path of this file into the dialog.  You can then click on "Run" to run the script or "Cancel" to return to FCEUX without running the script.
To end a Lua script, choose "Stop Lua Script" from where.
You're reading documentation for the windows version and trying to apply it to the portable version. They aren't the same. Learn to use wine or virtualization and use the windows version.
If you insist in using the portable version, you can use --loadlua myfile.lua, assuming your fceux has been built with lua support (and who can say how it was built on linux or osx?)

erlang from windows command line

Anyone knows how to open the Erlang shell from windows command line?
In official tutorial recommended to write "werl" to the command prompt but this command doesn't work.
P.S. I have installed erlang to my PC.
You have 2 simple ways to start an erlang shell on windows.
1) you can open a terminal directly into the folder that contains werl.exe you want. Use Shift + right click and choose "open terminal here". Then type "werl.exe"
2) you can go into that folder using "cd path", then type "werl.exe"
Also if you use werl.exe, a new window will open. If you want to stay with your windows terminal you should use erl.exe
werl uses the wxwidget library. Everything is installed automatically if you use the windows binary file.
If you have installed from source, then wxwidget must be installed separately.
It is possible to start the erlang shell in a dos window: start a command window with cmd, and start the erlang shell from this window using erl.
I guess that you already checked that werl exe is in the search path.

Convert iOS project to 64 bit using ConvertCocoa64 script

I need to convert my iOS project to 64-bit friendly (to get rid of compiler warnings, as in this question. The solution apparently is to run ConvertCocoa64.
I've managed to locate ConvertCocoa64 (which is no longer included in /Developer/Extras/64BitConversion/ConvertCocoa64) as the Apple docs suggest, but here (search for Auxiliary Tools)
So I've download the script. But my question is, how do I run this on my project? Please assume a total newbie level of knowledge here when it comes to the terminal and running scripts. Do I drop the script inside my project folder and just double click it? Or do I access it from the terminal? The docs say run this command:
/Developer/Extras/64BitConversion/ConvertCocoa64 `find . -name '*.[hm]' | xargs`
But since that folder doesn't exist, where do I run it?. I tried dropping the script in the Developer folder, but when I type ConvertCocoa64 it says command not found.
Find where the command is located now. You'll want to run it in the terminal using the full path to the command, as in your example, just with the real path.
A good way to get the full path is to locate the command in the Finder and drag it to an open terminal window - this also "escapes" any spaces in the path for you. The easiest way to hit all your files as arguments to the command is to cd (change directory) to your project first (in the terminal).
This should get you set up to follow the directions you have.
If I'm not mistaking, to run script, you should place dot . before command. Doesn't really matters, where script is situated as long, as it doesn't rely on it heavily
> cd ~/path/to/script/dir/
> ./ConvertCocoa64 ...

Syntax highlighting for Jade in Sublime Text 2?

I just started using Sublime Text 2 on Mac. I also just started using Jade for my views in Node.js, and am wondering if there is a way to add syntax highlighting for Jade into Sublime Text 2.
If you have git installed, this worked perfectly for me:
cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone https://github.com/davidrios/jade-tmbundle Jade
Bonus to get stylus syntax highlighting working run:
git clone https://github.com/stylus/stylus.git Stylus
Sublime Text 2 supports Textmate syntax definition files. There is a Jade Textmate bundle at https://github.com/miksago/jade-tmbundle.
Install by creating a new folder in your Sublime Text "Packages" folder, call the new folder Jade, then curl -O https://raw.github.com/miksago/jade-tmbundle/master/Syntaxes/Jade.tmLanguage or otherwise download that file into the new folder. The editor will load the syntax immediately.
Why yes, there is! And it uses a nice packaging system too:
If you need to, install Package Control from here
Open the command palette (command + shift + P) and go to Package Control (just type "install"). You may need to wait for the repository to be updated.
When in package control type "jade" to find the Jade Syntax Highlighting package. Hit enter to install it.
You now have syntax highlighting for Jade and a nifty package controller for other Sublime goodies. This search shows a lot of available tools for working with Jade, Jade+Bootstrap, pyjade, etc
Edit - Sublime doesn't need to be restarted after installing this package so this step was removed.
#jurka -
OS X:
~/Library/Application Support/Sublime Text 2/Packages/
Linux:
~/.Sublime Text 2/Packages/
Windows:
%APPDATA%/Sublime Text 2/Packages/
Clone into the path shown above for linux.
Jade is also available via the Sublime Package Control.
For ubuntu 11.10 correct path to packages for me is ~/.config/sublime-text-2/Packages
You can easily find your packages location using Menu: "Preferences" -> "Browse Packages..."
The accepted answer refers to a plugin that is deprecated and no longer active.
For those who are still looking for a supported Jade plugin for Sublime Text, you should use this repo:
https://github.com/davidrios/jade-tmbundle
This is also on Package Control:
https://packagecontrol.io/packages/Jade
If you are on Mac:
Go to Library/Applciation Support/Sublime Text 2/Packages/ then,
curl -O https://raw.github.com/miksago/jade-tmbundle/master/Syntaxes/Jade.tmLanguage
I've made the following on linux ST2 build 2221:
git clone https://github.com/miksago/jade-tmbundle.git Jade.tmbundle
Then
zip -r Jade.zip Jade.tmbundle/
mv Jade.zip Jade.sublime-package
mv Jade.sublime-package /sublime_folder_location/Pristine Packages/

Resources