Omnimaga
Calculator Community => TI Calculators => Lua => Topic started by: Adriweb on October 18, 2012, 04:58:12 pm
-
I have talked about "Intellij IDEA" on
the tinspire group (https://groups.google.com/d/msg/tinspire/JhFCHNtTrNg/2HWlBwTlcnkJ) as a Lua IDE (thanks to its wonderful Lua plugin), and I believe it can be quite good for you guys, especially for big projects where the current SDK isn't efficient (no support of multiple files etc.).
Here's some details on how to setup what you can see at the bottom of this post ;)
Basically, you can do either :
This (longer but it will make seperate SDKs for normal computer Lua and Nspire Lua)
- Download Lua for windows 5.1 (http://code.google.com/p/luaforwindows/downloads/detail?name=LuaForWindows_v5.1.4-46.exe)
- Add a new Lua SDK in Intellij (you can find that in the module settings, for example)
- Select the Lua folder in program files as the lua sdk folder.
- Download my addon and decompress it somewhere
- Add from my addon the folder "nspirelua-api" as an external classpath folder in your new SDK
- Save, apply, etc.
or (easier/faster but it will make computer lua think it has nspire lua API available) :
- In Intellij's ( / module's ) settings, edit the KahLua SDK
- Download my addon and decompress it somewhere
- Add from my addon the folder "nspirelua-api" as an external classpath folder in your new SDK
- Save, apply, etc.
After all that, create a new Lua project, and in the libraries on the left side, you should see not only the stdlib (of which you can unlink the io and debug API which aren't present on the Nspire), and you should be able to enjoy Intellij's Lua plugin things but for the Nspire Lua API too.
This it what it looks like when it's set up, on my computer :
Autocompletion example (of the events and other functions ) :
(http://i.imgur.com/Zh1eJ.png) (http://i.imgur.com/Zh1eJ.png)
(http://i.imgur.com/5yr6N.png) (http://i.imgur.com/5yr6N.png)
Auto-completion + arguments help :
(http://i.imgur.com/aFzak.png) (http://i.imgur.com/aFzak.png)
Interactive documentation based onInspired-Lua's wiki (http://wiki.inspired-lua.org) : (Ctrl-Q on a word)
(http://i.imgur.com/kFLhB.png) (http://i.imgur.com/kFLhB.png)
Nspire-Lua API plugin : download here (http://tiplanet.org/forum/archives_voir.php?id=8182) (http://tiplanet.org/forum/archives_voir.php?id=8182)
Good luck and have fun :)[/list][/list]
-
Wow this is awesome! Can it run the programs too or do you still need the TINCS/Handheld to test? (I guess the latter :P)
-
Wow this is awesome!
Thanks :)
Can it run the programs too or do you still need the TINCS/Handheld to test? (I guess the latter :P)
Indeed this is just for editing.
But then you have for example Luna, which you can use in a shell script to build your files and open the .tns in the software etc, all that called from within the IDE with a build configuration.
We use that for FormulaPro : https://github.com/adriweb/EEPro-for-Nspire/blob/master/build.sh
Edit : however, if you want to test out some algorithms for example, written in "pure" lua, it will run indeed in the console :) (for that you have to install Lua for your computer tho)
-
Note that FormulaPro will eventually use the new build system I made :)
Nice work Adriweb !
-
Thanks :)
-
Is it possible to do this with the
Making the words that are commands to be colored in text program like etexteditor copy for windows of textmate (mac)
-
I'm not sure what you mean, but if you mean syntax highlighting then yes it does that.
-
Just a little tip for folks on windows and with more than one file to compile in luna:
type 1.lua 2.lua 3.lua > output.lua
luna.exe output.lua output.tns
del output.lua
PS: in most cases (at least for me) is better to specify manually files in order to be compiled than trying type *.lua >output.lua
-
I can't believe I haven't seen this before. This will really help me try and get back into Lua programming.
Now only thing is more convenient .lua -> tns conversion and loading into emulator, which there might be some tools lurking around that I haven't discovered, or forgotten, or not know how to use.
-
Pretty good.
I wanna write a visual IDE later based on XML and SM
-
To load the file into the emulator, maybe some AutoIt hack would as I did for the NdlessEditor.
-
Hmm, seeing activity on this topic reeminded me that I had a 2.1 version of the plugin that I just uploaded : http://tiplanet.org/forum/archives_voir.php?id=8182
No major things but improvements here and there.
Also, depending on IDEA's version (apparently), some autocompletions get better, some "worse" (not so bad but...), meh, it's still very helpful :)
BTW, I have set up in the IDE a special "tool" that makes me able to directly launch TINCS with the script (it saves the .lua file, calls Luna on it, and launches it.)
It's a simple one-liner, and can trivially be ported to a Mac command. As for Linux (and actually nspire_emu, it would require a bit more work, yes...)
-
How do you get the interactive documentation and arguments help configured properly? I haven't got them working, I've got the autocompleting menus popping up fine but I'm not sure if I've stuffed up config of libraries at some point (putting into Kahlua)
-
I haven't figured out a way to get args hemp 100% of the time.
It' pretty much because things that are passed by the functions aren't really recognized as external elements (gc for example) that it can look up for help.
Try not passing (temporarily, while you write) gc as an argument, for example, and start typing 'gc:drawS' for example. Sometimes with "gc." I'm not sure.
The Lua addon is great but not so wonderful with external APIs that have objects stuff like this...
Anyway, my setup instructions is nothing more than what I've written in the first post of this topic
-
hello adriweb,
maybe we can write a Visual Lua based on C#,GDI+,XML and Screen Manager.
how do you think of it?
I think it would be a vase but profound project.
-
Where are the module settings? I could only find plugin settings where I could install plugin including Lua from repositories.
-
can have detailed tutorial for this
i am stuck the part with no sdk
i downloaded intellij idea yesterday
thanks in advance
hking1
-
For now I'm still using the combination of Notepad++/luna/kArmTI to code and test my Lua code.
-
I tried this again, a year later with IntelliJ 13.1.4 and the process seems to be even more convoluted than before. IntelliJ itself has seemed to turn more Eclipse like focusing on Java and stuff.
I had to restart after installing the Lua plugin. Then after adding the nspireLua API library. It wouldn't detect auto-complete when I tried to type "function on." However it seemed to work for "timer", and other single words.
Fetching documentation (Ctrl+Q) does not retrieve from inspired-lua wiki (Unless the wiki page has no info?)
I tried messing around with module and plugin settings but I don't know what I am doing, even after now I have some experience with IDEs such as Eclipse.
-
I tried this again, a year later with IntelliJ 13.1.4 and the process seems to be even more convoluted than before. IntelliJ itself has seemed to turn more Eclipse like focusing on Java and stuff.
Well, Intellij IDEA is a Java IDE. But supports some plugins making it capable of handling other languages.
I had to restart after installing the Lua plugin.
Yes, after each plugin install, you have to restart the IDE.
Then after adding the nspireLua API library. It wouldn't detect auto-complete when I tried to type "function on." However it seemed to work for "timer", and other single words.
Hum, that works for me :
(http://i.imgur.com/LJvLJ3E.png)
What doesn't really work is gc: autocompletion (or any class instance I believe).
In fact, for gc autocompletion, it works if you don't put "gc" as parameter in the function you're in, while you're coding it (when you're done, obviously put it back) :
(http://i.imgur.com/Q7f2CpG.png)
Fetching documentation (Ctrl+Q) does not retrieve from inspired-lua wiki (Unless the wiki page has no info?)
That used to work... I'll take a look at what changed/broke.
-
Fetching documentation (Ctrl+Q) does not retrieve from inspired-lua wiki (Unless the wiki page has no info?)
That used to work... I'll take a look at what changed/broke.
Ah I just realised. It seems to fetch from internal documentation (within Kahlua/Lua or similar). There is a button (up arrow) called External documentation, that when I clicked it, led me to the corresponding wiki page.