• Jens' Script Editor - An on-calc lua editor 5 2
Currently:  

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

0 Members and 1 Guest are viewing this topic.

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 #180 on: July 09, 2014, 04:05:00 pm »
-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 )

That makes sense, but you should at least be able to minimize the header so that you don't have to scroll through it.


Anyways, I probably won't be downloading JSE updates for a while, my calculator is broken and its useless on Student Software. I might be able to get a new one at the start of the school year but I'm not sure yet.



Offline DJ Omnimaga

  • Former TI programmer
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55823
  • Rating: +3151/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • DJ Omnimaga Music
Re: Jens' Script Editor - An on-calc lua editor
« Reply #181 on: July 10, 2014, 12:04:38 am »
Wow I just saw the new features being added and the interface screenshots and good job. I like how this looks more and more like some sort of professional computer IDE. O.O
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF



T-Shirt store | Reverbnation | Facebook | Youtube | Twitter

Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #182 on: July 11, 2014, 11:07:51 am »
The last update includes some ncie functionality. However I found some bugs:
- the autocomplete function will only find functions for gc if you have "gc" or "gc:". Any further character won't be seen as part of "gc:", so "gc:f" will result in autocomplete option "for" and "function"
- When I tried to execute a script rebinding functions of the event handler using "setmetatable(on)" I encountered the problem that your execution page did this too and overwrote my event handler

And some ideas:
- Include other files saved in the editor as kind of header. Not just a standard header but any file that can be loaded from inside the editor
- make the autocompleter recognize variables and user functions
- include the standard table library to the autocompleter (you could also search _G and its subtables for available functions and tables)
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 186
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #183 on: July 11, 2014, 03:34:08 pm »
That makes sense, but you should at least be able to minimize the header so that you don't have to scroll through it.
Yes, but work! I'll have to completely rewrite many functions to make it possible to collapse/expand parts of the code; that'll take some time. I'll first implement a faster method of scrolling (as you suggested months ago); I only have to find a event for that: I think I'm already using all available Buttons  :/


Anyways, I probably won't be downloading JSE updates for a while, my calculator is broken and its useless on Student Software. I might be able to get a new one at the start of the school year but I'm not sure yet.
That's bad news! I hope that won't keep you from developing!


- the autocomplete function will only find functions for gc if you have "gc" or "gc:". Any further character won't be seen as part of "gc:", so "gc:f" will result in autocomplete option "for" and "function"
- include the standard table library to the autocompleter (you could also search _G and its subtables for available functions and tables)
I think you don't have the newest version; I already fixed both ;)

- When I tried to execute a script rebinding functions of the event handler using "setmetatable(on)" I encountered the problem that your execution page did this too and overwrote my event handler
Yes, that part of the code had some mistakes; it was on my todo-list to rewrite it for a while... I'll fix it for the next alpha release!

- make the autocompleter recognize variables and user functions
That'll be work too because the editor deosn't understand anything of the written code yet, it only colors it correctly. But soon holidays begin and I'll have more time to work then!  :)
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 #184 on: July 11, 2014, 03:41:20 pm »
That makes sense, but you should at least be able to minimize the header so that you don't have to scroll through it.
Yes, but work! I'll have to completely rewrite many functions to make it possible to collapse/expand parts of the code; that'll take some time. I'll first implement a faster method of scrolling (as you suggested months ago); I only have to find a event for that: I think I'm already using all available Buttons  :/

You don't need collapsible functions, just have a menu item that hides the header.

Anyways, I probably won't be downloading JSE updates for a while, my calculator is broken and its useless on Student Software. I might be able to get a new one at the start of the school year but I'm not sure yet.
That's bad news! I hope that won't keep you from developing!

Hopefully it won't, I may get a new one at the beginning of the new school year, and I still have student software.

« Last Edit: July 11, 2014, 03:56:29 pm by LDStudios »



Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #185 on: July 11, 2014, 04:49:09 pm »
- the autocomplete function will only find functions for gc if you have "gc" or "gc:". Any further character won't be seen as part of "gc:", so "gc:f" will result in autocomplete option "for" and "function"
- include the standard table library to the autocompleter (you could also search _G and its subtables for available functions and tables)
I think you don't have the newest version; I already fixed both ;)
Even in the newest version the table library is not included to autocomplete ;) The coroutine library is mising, too
But the stuff with gc works fine :)

- make the autocompleter recognize variables and user functions
That'll be work too because the editor deosn't understand anything of the written code yet, it only colors it correctly. But soon holidays begin and I'll have more time to work then!  :)


Maybe you could load the code, cycle through the loaded _G and extract the functions? But I'm not sure if that would work
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #186 on: July 20, 2014, 06:11:46 am »
On JSE 2.0A3 3.1, the multi-lines commentaries don't work:
Code: [Select]
--[[
A commentary
on several lines.
]]

JSE 2.0A4 doesn't work on 3.1.

It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.

EDIT: Special characters like "é", "è" and "à" don't work.



Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #187 on: July 20, 2014, 06:37:48 am »
It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.
The problem is that such a feature requires ndless and many people don't have ndless installed.
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

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 #188 on: July 20, 2014, 06:47:39 am »
Sure, but for those who have it installed, the features is available and for those who don't, it's just "hidden" (or does nothing).
Detecting if ndless is installed is just doing : "if ndless then ... end", I believe. (that's because Ndless adds a global table called 'ndless' to Lua)


But that's not the "hard" part. The actual ndless hook (lua extension rather) that makes a proper .tns from a script is doable, I assume, but it would take a bit of work...


(@mdr1 : comments*)
« Last Edit: July 20, 2014, 07:22:18 am by Adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 186
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #189 on: July 20, 2014, 09:45:19 am »
On JSE 2.0A3 3.1, the multi-lines commentaries don't work:
Code: [Select]
--[[
A commentary
on several lines.
]]
It works, but the editor doesn't mark it correctly.

JSE 2.0A4 doesn't work on 3.1.
What's the problem? Does it not open, does it crash or does the menu not work?

It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.
I don't have ndless installed and I don't want to install it. But it's even possible with lua: A file where you can paste your code in and from then on it directly executes it everytime you open the file. It would handle exactly like a normal program with the given code. The only difference would be, that the file has a small script included, which loads the code from the memory.

EDIT: Special characters like "é", "è" and "à" don't work.
Yes, I switched back from rendering unicode characters to only ascii characters because of performance issues. Although they look strange in the editor, lua still handles them correctly.
Sorry for nonsense.

Projects:



Offline CinusMinus

  • LV3 Member (Next: 100)
  • ***
  • Posts: 43
  • Rating: +4/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #190 on: July 20, 2014, 05:18:48 pm »
It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.
I don't have ndless installed and I don't want to install it. But it's even possible with lua: A file where you can paste your code in and from then on it directly executes it everytime you open the file. It would handle exactly like a normal program with the given code. The only difference would be, that the file has a small script included, which loads the code from the memory.
itched back from rendering unicode characters to only ascii characters because of performance issues. Although they look strange in the editor, lua still handles them correctly.
Which is basically not much different from oclua. It would only keep the code forever.

But that's not the "hard" part. The actual ndless hook (lua extension rather) that makes a proper .tns from a script is doable, I assume, but it would take a bit of work...
Porting luna should do the job. The problem is that all libraries required to build luna have to be ported to ndless, too.
Projects:
Chicken Invaders [Finished]
TI.Image Tools [Finished]
MC2D Texture Pack Creator [Finished]
HillClimbRacing [In Development]

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 #191 on: July 20, 2014, 06:34:07 pm »
@CinusMinus : nah, no need to port Luna, the OS has all the functions needed to create/encrypt/compress the XML into a proper .tns ;)
But then, it's a matter of finding them all (might have been done already) and call them correctly.
« Last Edit: July 21, 2014, 10:44:32 am by Adriweb »
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 #192 on: July 21, 2014, 10:40:50 am »
It works, but the editor doesn't mark it correctly.
That's what I meant. :)

What's the problem? Does it not open, does it crash or does the menu not work?

It seems you added JSE 2.0A4 3.1 but neither does it works. When I try to open it, the OS says the device has to be updated to open it.

Why does the unicode involve such performance issues?



Offline Jens_K

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 186
  • Rating: +52/-0
    • View Profile
Re: Jens' Script Editor - An on-calc lua editor
« Reply #193 on: July 21, 2014, 12:05:50 pm »
What's the problem? Does it not open, does it crash or does the menu not work?

It seems you added JSE 2.0A4 3.1 but neither does it works. When I try to open it, the OS says the device has to be updated to open it.
Indeed, I had a problem registering my platform.withGC fallback function on apilevel="1.0", so I just disabled it and forgot to reenable it later, sorry!
Download the OS 3.1 version again to get the fixed file!
Thanks for the report!

Why does the unicode involve such performance issues?
Splitting a string in its characters and mind UTF-8 encoded unicode characters is a bit difficult. The Nspire API offers a special string.usub function for that, but it's slower than the normal string.sub function. Now after much optimizing, this wouldn't have a big impact anymore; I could switch it back, but there is  another problem: Most functions of the string library doesn't have a unicode equivalent, so I have to use the normal ascii-only functions. Using unicode characters at rendering, but using ascii-functions for editing leads to confusion results: I had this setup for v1.0 and there you can see offset cursor positions other weird behaviours when using unicode characters.
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 #194 on: July 21, 2014, 01:03:29 pm »
If you want/need a string.ulen function, here you go :
 
Code: [Select]
function string.ulen(s) return select(2, s:gsub('[^\128-\193]', '')) end
(from https://github.com/Pogs/lua-utf8-simple/blob/master/utf8_simple.lua )