Author Topic: Jens' Script Editor - An on-calc lua editor  (Read 144169 times)

0 Members and 1 Guest are viewing this topic.

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Jens' Script Editor - An on-calc lua editor
« on: July 10, 2013, 05:12:27 pm »
Hi,
Inspired by "oclua" I started to make an own on-calc lua editor and finished the first version of it in summer 2013. It had many flaws and lacked some important features, so I decided to make a second, vastly improved version of it:

Features:
- Fully functioning code editor on page 1.1
  - Monospaced characters
  - Syntax highlighting (customizable)
  - Autocompletion menu: basic lua functions, nspire api function, global script variables, custom items
  - Undo/redo actions
  - Select code to copy, cut, paste, etc.
  - Find function
  - Save & load infinite amount of scripts with length each up to 1.7 million characters
  - Hotkeys for special characters
  - Full support for UTF8-encoded unicode characters
  - Import code from librarys and saved scripts
  - Autosave function
  - Customizable color-set
  - Customizable font

- Entirely crash protected live testing on page 1.2
  - Nearly no restrictions
  - Full support of event handlers using "on"s metatable
  - Resets global environment after each build
  - Pause/Unpause scripts
  - Full module (physics & colors) support
  - Calls all initialization event handlers
  - Full support of 2DEditors

- Console
  - Logs "print" outputs, errors and status logs of the editor
  - Can be deleted, copy&pasted and resized with Nspires layout options
  - Commands can be entered to execute them during live-testing a script

- Shortened portable version of the Nspire api reference guide on page 2.1
- Shortened portable version of the lua reference manual & chipmunk physics api guide on page 2.2

- Compatible to:
  - OS 3.1 and OS>3.1
  - Greyscale models
  - Clickpad models
  - Desktop
  - iPad



Current Version: 2.2.1
Current Size: 73KB

The attached zip file contains the editor files for OS 3.1 and OS>3.1, controls pictures of both Nspire layouts and a readme.txt

Bug reports are welcome!  :) 

Spoiler For old post:
Hi,
I recently found oclua.tns and I liked the idea of an on-calc skript editor but I didn't like to write code in the "Notes" app. Therefore I started to make a fully functioning on-calc skript editor based on the idea of how oclua works. I also managed to prevent crashes of the editor because of a crash in the written code! I've been working on it several weeks now and I think it's time to show you the progress:

Main features:
- fully functioning code editor
- run your code without any limitations
- stop it
- it wont crash (except for infinite loops)
- Syntax is colored
- Save infinite amount of skripts
- Select code to copy, cut, etc.
- undo/redo actions
- Import code from librarys
- shortened portable version of the nspire api reference guide on page 1.2
- Most math buttons get converted to valid lua code
- compatible to:
  - OS 3.x
  - Greyscale models
  - Clickpad models
  - Desktop
  - iPad

Planned Features:
- Undo/redo actions  Done in 0.4
- Select/Mark code to copy/paste etc.  Done in 0.3
- Make things safer to use, like "File"==>"New"  Done in 0.2
- mark operators'n'stuff correctly  Done in 0.2
- help and instructions  Done in 0.2
- support for the clickpad layout  Done in 0.1.1
- better visuals for greyscale displays  Done in 0.1.1

Eventually future features:
- shortened portable version of the nspire api reference guide  Done in 0.4.2
- paint a picture, convert it and put it into your code on-calc  Use nSpaint!

Controls:
Spoiler For Controls:
nspire touchpad:


nspire clickpad:


Screenshots:
Spoiler For Screenshots:



API Reference Guide:


By now the file is 28KB in size and it has about 1400 lines of code (without the API Reference Guide).

Current version: 1.0.2

Sorry for language errors :P

Download it here: http://www.ticalc.org/archives/files/fileinfo/454/45484.html
« Last Edit: January 12, 2017, 11:13:23 am by Jens_K »
Sorry for nonsense.

Projects:



Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #1 on: July 11, 2013, 05:25:39 am »
This is great! As you may or may not be aware there have been several previous attempts at creating a on-calc lua editor, after oclua. yatto made a lua editor called LuaCS, and Levak created a fork from it. Actually I also remember someone else translating the French from Levak's version.
http://ndlessly.wordpress.com/?s=luacs

But yours seems the most featured packed at the moment :)

Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #2 on: July 11, 2013, 05:34:03 am »
wait, we get to program lua on-calc? AWESOME!

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #3 on: July 11, 2013, 06:04:23 am »
I just realised something. The braces and brackets don't work on a clickpad, because they are grouped together as one button, unlike the touchpad. Hope you can fix this to accomodate clickpads too! The other buttons seem to work fine.
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #4 on: July 11, 2013, 07:50:01 am »
@Jonius7:
1.) No, I didn't know that... LuaCS looks better than mine, but there's no actual error handling and oclua keeps crashing as it has always done. Also you only can save 1 program. Also characters like [] and {} and : are as tedious to type as they were in the "Notes" App.
2.) The image is edited; there aren't really "[]" and "{}" Buttons, I redefined following buttons: "e^x"==>"["; "10^x"==>"]"; "ln("==>"{"; "log("==>"}"; "(-)"==>":"
It's very handy like this on the touchpad layout. I'll implement a feature to swap the layout, maybe the "cos" and "tan" buttons for "[" and "]" and the "^-1" versions for "{" and "}"? Unfortunately I don't know anyone with a clickpad nspire to try it out :/


Sorry for nonsense.

Projects:



Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #5 on: July 11, 2013, 11:48:45 pm »
Interesting. Is it in any way related to the SDK that recently made front page news on TI-Planet or was it something else?

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #6 on: July 12, 2013, 04:02:47 am »
I think yours looks quite good. Maybe because you're using "serif" font instead of "sansserif" which I think the other ones use.

Also I have a clickpad, but I used kArmTI (nspire_emu with extra features, I recommend it) to test the clickpad, it can handle all the main 6 editions of TI-nspire.
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #7 on: July 12, 2013, 04:10:57 am »
Quote
(nspire_emu with extra features, I recommend it)
Its closed-source nature is not a good thing for the community, though.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #8 on: July 12, 2013, 07:07:25 am »
This looks really nice. I especially like the not-crashing-on-error part :D This drives me to get back to Lua programming again now that it's portable once more. I hope you stick with the project.

Some people need a high five in the face... with a chair.
~EC

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #9 on: July 12, 2013, 07:08:03 am »
Quote
(nspire_emu with extra features, I recommend it)
Its closed-source nature is not a good thing for the community, though.

A bit off topic but yeah.
Is the version on mediafire updated? I downloaded it before you made those changes about [] {}

Also about painting a picture, you might want to look at nSpaint. http://ourl.ca/12418
perhaps you could call integration of that program with the Skript editor as you did with executing the script itself :).
« Last Edit: July 12, 2013, 07:11:39 am by Jonius7 »
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #10 on: July 12, 2013, 09:51:01 am »
@Jonius7: nspire
1.) Thanks for your the hint for the emulator, but I don't get it to work: everytime I try to start "nspire_emu.exe" a black window flashes once and nothing else happenes :/
2.) I haven't made an update yet, because I don't get the emulator to work :/ But those button rebinds are already in the current version.
3.) BIG thanks for that reference to nSpaint!!! :D Now I don't have to do that; Chockosta wrote ~2200 lines of code for that! I'll ask him for permission for integration or I'll just put a note somewhere...
« Last Edit: July 12, 2013, 10:21:57 am by Jens_K »
Sorry for nonsense.

Projects:



Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #11 on: July 12, 2013, 04:22:15 pm »
Looking really good already.

If you want to use nspire_emu, there's a tutorial over at TI-Planet: http://tiplanet.org/forum/viewtopic.php?f=15&t=8698.

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #12 on: July 12, 2013, 05:53:15 pm »
UPDATE!
Version 0.1.1 now attached on the first post

New features:
- math button input get converted to lua code (like the root or the pi button)
- better visuals on greyscale displays
- support for clickpad layout (switch in the menu) explanation in the "Controls" spoiler of the first post
- settings will be saved now

@lkj: Thanks for the link! I'll test now what I just updated on the emulator :P
« Last Edit: July 12, 2013, 06:03:59 pm by Jens_K »
Sorry for nonsense.

Projects:



Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #13 on: July 13, 2013, 06:31:22 am »
@Jonius7: nspire
1.) Thanks for your the hint for the emulator, but I don't get it to work: everytime I try to start "nspire_emu.exe" a black window flashes once and nothing else happenes :/
2.) I haven't made an update yet, because I don't get the emulator to work :/ But those button rebinds are already in the current version.
3.) BIG thanks for that reference to nSpaint!!! :D Now I don't have to do that; Chockosta wrote ~2200 lines of code for that! I'll ask him for permission for integration or I'll just put a note somewhere...

Yeah nspire_emu is command line, unless you run it from a cmd it does the flashy window thing.
kArmTI by SpiroH (http://ourl.ca/16585), adds a nice gui interface and a whole lot more.
Both take a bit to understand how to set up (which is kinda annoying :(, but worth it in the end :) )
« Last Edit: July 15, 2013, 12:46:28 am by Jonius7 »
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Jens' Skript Editor - a on-calc lua editor
« Reply #14 on: July 13, 2013, 06:50:40 am »
1.) Thanks for your the hint for the emulator, but I don't get it to work: everytime I try to start "nspire_emu.exe" a black window flashes once and nothing else happenes :/
https://tiplanet.org/forum/viewtopic.php?f=57&t=8698
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua