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

0 Members and 1 Guest are viewing this topic.

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' Script Editor - An on-calc lua editor
« Reply #165 on: May 28, 2014, 12:27:56 am »
I wonder if all OS 3.6 lua programs are guaranteed to run on 3.2? That could be an alternative as well. I'm just worried that now that Ndless 3.6 is out, fewer and fewer people will keep OS 3.1 and 3.2 compatibility, especially in games.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Jens' Script Editor - An on-calc lua editor
« Reply #166 on: May 28, 2014, 02:12:45 am »
If you're using 3.2's apilevel (thus not using the new image/resource system, yes, the script (code) will be compatible.
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #167 on: May 29, 2014, 05:59:33 am »
Yes, this prerelease works only on OS>=3.2! I didn't think anybody still uses OS 3.1. Is there a special reason that you still use it? Because I'm not sure if I should still support OS3.1
Well, I'm not alone to remain on OS 3.1 because since the 3.2, many many bugs and display issues appeared.
But too bad if it's too much work. ;)



Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #168 on: June 09, 2014, 04:50:31 pm »

Hello!
After wasting a bit of time with fractals I finished the second v2.0 alpha release today :) I also tried to use the "callStack" and "locals" information of the registered error handler but unfortunately those are not available for code loaded with the loadstring function, so this feature will not be possible to implement.  Anyways, here's what's new:


New features:
- the whole color-set can be customized now (menu => Style => Customize) (no custom syntax coloring yet!)
- added menu to the console application: choose which logs you want to get displayed! (The small squares in the upper right corner are indicators: black=print; red=errors; blue=status)
- now use of platform.registerErrorHandler ==> no crash possible anymore (on apilevel>1.0)
- use of custom error handler is still possible
- safe use of 2DEditors: they get removed as soon as you stop the script


Improvements/Changes:
- various fixes
- slightly optimized and improved syntax colouring
- now all dialogues are centered
- switched back to rendering only ascii characters because of performance; they still work but in the editor they are representated by their UTF-8 code
- added dialogue for stopping the user script


I also noticed that I have fallbacks for all apilevel 2.0 features, so I can continue the support for OS3.1 for now :)
Sorry for nonsense.

Projects:



Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
Re: Jens' Script Editor - An on-calc lua editor
« Reply #169 on: June 09, 2014, 05:03:50 pm »
So nice to see that you are working on this! I like the idea of custom styles, but the controls for it are a bit awkward right now. I'm even more excited about the use of errorhandler to prevent crashing. Great work and I look forward to the next release!
Also, could you add more to the standard libs in your API Reference Guide on calc? I had not being able to check the string and math libraries on calc.



Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #170 on: June 10, 2014, 11:42:42 am »
3.1! Great! I found a bug: when I launch the script and I modify it by removing a character, the application makes an error:
991: attempt to index field '?' (a nil value)

LDStudios: Those libraries are in the guide in the editor.



Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #171 on: June 10, 2014, 01:07:20 pm »
3.1! Great! I found a bug: when I launch the script and I modify it by removing a character, the application makes an error:
991: attempt to index field '?' (a nil value)
Oh, yes, thank you for the report! I forgot some handlers for the new dialogue... Just don't try to modify your code while the script is running for now  ::)


LDStudios: Those libraries are in the guide in the editor.
LDStudios ment the standard libraries explained here: http://www.lua.org/manual/5.0/manual.html#5.1. I now plan to make an addable library file that includes the extended guide data  :)
Sorry for nonsense.

Projects:



Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #172 on: June 27, 2014, 09:49:09 am »

Hi, sorry for this late update, but I didn't have much time lately...
Anyways here's the 3. alpha release of v2.0!


New Features/Improvements:
- change fontsize with "shift" & "+" and "shift" & "-"
- global environment now resets for each new build
- ctrl+M selects the current line and moves the cursor to its end
- rudimentary "find" function (menu=>"View"=>"Find")
- 90% faster and more accurate syntax colouring algorithm  (image code is defenitely no problem anymore!  :) )
- EE key now inserts a "#"
- improved file name format (longer names and less bugs)
- button rebindings now also works for dialogue inputs


Bugfixes:
- fixed a crash after undoing (still many bugs to fix with undoing...)


I also started working on a gui engine for better dialogues and easier and faster development of the guis for customnizations and other advanced functions!  :)
« Last Edit: June 27, 2014, 10:03:28 am by Jens_K »
Sorry for nonsense.

Projects:



Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #173 on: July 08, 2014, 01:02:31 pm »
Hi! Great work!

The ctrl+M doesn't select anything on 3.1 and the menu is unopenable though.



Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #174 on: July 08, 2014, 04:56:56 pm »

So, here is the 4. alpha release of v2.0!


New Features & Improvements:
- implemented gui engine ==> better dialogues
- fully functional "find" function
  - option to search only whole word
  - option to search from cursor or from script start
  - enable/disable case sensibility
- autocompletion: press the return(↵)-key to open the autocompletion menu (customizability planned)
- color of strings, comments, keywords and lua standardFunctions is now customizable (proper syntax marking options are planned)
- replaced the old "Load" menu by a new filemanager
  - function to rename files
  - saved files can now be seen by OS 3.1!
- polished look of user script page


Fixes:
- moved menu initialization into on.activate ==> menu shows up on all OS again (sorry, forgot to fix it earlier :P )
- removal of "carriage return" characters of pasted texts


PS: I wrote the gui engine from scratch and didn't do thaat much testing, so some features might be a bit buggy! Feel free to report all bugs you find!  ;)
« Last Edit: July 22, 2014, 09:36:42 am by Jens_K »
Sorry for nonsense.

Projects:



Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Jens' Script Editor - An on-calc lua editor
« Reply #175 on: July 08, 2014, 06:14:14 pm »
Very nice :D
(I summed it up on tiplanet, btw)

Also, it crashed (line 2327 : attempt to index field '?' a nil value) when I tried to copy a part of the code I selected.

Why don't you just enable the errorHandler, by the way, for "releases" ? :P
(I don't recommend enabling it while writing/debugging, though ^^)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
Re: Jens' Script Editor - An on-calc lua editor
« Reply #176 on: July 08, 2014, 09:06:38 pm »
I missed a lot while on vacation, this is looking amazing!
I can't wait to try it, great work as always!

I have a few suggestions:
-Ability to enable a specific key to restart script while on the page that runs it (any key or no key) because its annoying to do ctrl+left, escape, menu, enter, enter every time you want to restart it.
-Custom Libraries, with Adriweb's Better Lua API as a built in library. Also the ability to add other libraries of your own.
-Menu Items that are toggle based should have a checkmark next to them when turned on (checkmark character is in the character lib.. somewhere) EDIT: for things like font, write the current font next to it.
-Still waiting for that Standard Lib API guide  ;)

EDIT:

Okay, so I tried it out, and I have a few more suggestions/bug reports:
-Use of cursor.set() for selecting items in a dialog box, and for buttons
-Ability to  click the X in the top right of the customize box
-Clicking outside of a dialog box is the equivalent of pressing escape
-The application that runs the script didn't work for me until I clicked on the page, after the first time it worked fine
-In the customization menu, draw a square with the current color of the item, next to the name of the item so you can tell what it is currently set to
-Ability to mark check boxes with cursor as well as buttons
-Customization of syntax separate from customization of other stuff
-Ability to save custom themes
-Ability to customize dialog box colors

Also, how did you use ctrl+M to select the line?

2nd EDIT: I just wrote a lot of stuff ^ I understand if you don't want to do any of it, or if its just too much. Just a few of my thoughts to improve. Can't wait for the next update!  :D
« Last Edit: July 08, 2014, 09:53:44 pm by LDStudios »



Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #177 on: July 09, 2014, 08:41:46 am »
Nice new features ! ;)

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 187
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #178 on: July 09, 2014, 03:47:27 pm »
Very nice :D
(I summed it up on tiplanet, btw)
Nice! I like that updates still get translated to ti-planet for the french community!  :)


Also, it crashed (line 2327 : attempt to index field '?' a nil value) when I tried to copy a part of the code I selected.
Thanks for the report, but I was not able to recreate the bug and I have no idea what could have caused it... But I made that part a bit safer to prevent a crash

Why don't you just enable the errorHandler, by the way, for "releases" ? :P
(I don't recommend enabling it while writing/debugging, though ^^)
Yes, you're right, I'll  do that  ;)




@LDStudios: First, thanks for all the good suggestions and reports!
-Custom Libraries, with Adriweb's Better Lua API as a built in library. Also the ability to add other libraries of your own.
Sorry, but I don't like the idea of a special environment. I want to keep the compatibility of the script as it is to any emulator. But you could pack the library into a library file and load it in your script! Another option would be, that I'll implement the option of setting a custom standard "Header" which is inserted in every new file you create. (Sorry, my english is bad today  :P )

-Ability to  click the X in the top right of the customize box
-Ability to mark check boxes with cursor as well as buttons
This is both already possible; it's just nearly impossible to aim correctly with the "text" cursor. But, as you mentioned, I'll change to the default cursor for dialogues in future ;)


-The application that runs the script didn't work for me until I clicked on the page, after the first time it worked fine
That's probably because the console application was focused. That's not really a bug, because the execution of the script in the user script page is triggered by the "on.activate" event, which is only triggered if it's application is focused.

-Ability to save custom themes
Indeed, it works fine on the emulator but doesn't on the handheld. The problem seems to be that var.recall apparently doesn't work in the first call of on.activate. I hate that TI doesn't mention such things in their guide and have such differences between emulator and handheld...  :(  I'll try to find an other suitable event for initialization that fits all needs then...  :/


Also, how did you use ctrl+M to select the line?
ctrl+M triggers the on.createMathBox event on OS>3.1

I added all the other things you wrote to my todo-list  ;)

Sorry for nonsense.

Projects:



Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Jens' Script Editor - An on-calc lua editor
« Reply #179 on: July 09, 2014, 03:56:04 pm »
-Ability to save custom themes
Indeed, it works fine on the emulator but doesn't on the handheld. The problem seems to be that var.recall apparently doesn't work in the first call of on.activate. I hate that TI doesn't mention such things in their guide and have such differences between emulator and handheld...  :(  I'll try to find an other suitable event for initialization that fits all needs then...  :/


TI does warn about this kind of stuff for other functions... but apparently they forgot this one ?
Anyway, on.resize makes a good init functions.


But all that's obsolete with 3.9 where you can call any Nspire API function without having to worry if it's going to work (it will, as they kind of fake a first initial lua script setup, then launch the user code, so that the API is indeed ready.) So, basically, you're able to make an init() function and call it right after and whenever you need it.
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation