Author Topic: Native Lua Extensions thanks to the latest Ndless update !  (Read 8736 times)

0 Members and 1 Guest are viewing this topic.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Native Lua Extensions thanks to the latest Ndless update !
« on: February 16, 2012, 06:21:01 pm »
The latest Ndless update provides a wonderful we've been excited about for some time now : Third-Party Lua Extensions !

You can see the news article on TI-Planet.org there, or right here directly translated in English :


Hi all, Today is a great day (like many others these days...)
You know already that, on the Nspire, it was possible to program in:

  • Basic : the more integrated with the OS, with great math interactions. However, it is slow and has few graphics possibilities etc..
  • Lua : Since OS 3, TI added this interpreted language that fits the Nspire very well and provides great improvements over the Basic, thanks to strong performances in both graphic and power etc.. Lua is known to be easy to use and flexible in terms of language itself.
  • C / Asm : Thanks to jailbreak Ndless. This is the most powerful because it directly controls the calculator's processor (ARM9). However, it is quite difficult to master especially for beginners.

Now Extended (Ndless author) offers to combine the power of C with the simplicity of Lua, with the "xLua" (for "eXtendedLua ", but it is I who named like that, Extended did not specify a name. ... )
I am announcing today the appearance of native extensions on Lua!

Mix native routines with your Lua scripts (using Lua modules)!
Isn't that awesome ?

To take advantage of this new feature, download the latest version of Ndless (see end of this post), and once installed, transfer samples/luaextdemo.tns to a folder named ' /ndless/luaext 'on your TI-Nspire, and run runluaextdemo.tns to have a simple example (prints "hello world" on the console). Note by the way the return of "print ()" (sound output is back !) that TI was removed in version 3.1 ... 
 
Writing extensions is fairly simple and is based on the C API standard Lua. You can judge for yourself in the sources available in the download ( src/samples/luaextdemo ).
Official Manual: http://www.lua.org/manual/5.1/manual.html#3
For now, only a few API functions are available, but this is improving day by day!
 
We can therefore take advantage graphical routines faster! (Especially for images ...)
 
Your extensions ideas are welcome !
 
Download the latest version ( r547 ) of Ndless 3.1: http://tiplanet.org/forum/archives_voir.php?id=3891

Please note that this "xLua" feature is this in development and can be buggy, so use it at your own risks :)
« Last Edit: February 16, 2012, 06:45:51 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

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: Native Lua Extensions thanks to the latest Ndless update !
« Reply #1 on: February 16, 2012, 06:37:57 pm »
I thought your news would be about nCrysis or nStarcraft??? O.O

j/k awesome. :) So basically we can now use C/ASM in our Lua programs? It might be nice because some people tend to have troubles programming some stuff in C or ASM, so while parts of their games (usually ones that requires speed) are written in native language or C, they can write the rest in Lua, right? It reminds me how on the TI-83+ we got xLIB and Doors CS BASIC libs, how in Axe we got axioms and how on 68K calcs we got Vertel/Flib. :)

Btw you should really put download links to this in the downloads section here, even if it redirects to TI-Planet. It would still be easy to keep up to date, but also give the program more visibility. :)

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #2 on: February 16, 2012, 09:35:34 pm »
This is a pretty interesting improvement, but I'm not sure if I'll use it. :P

Does this mean you can actually get a clock on the Nspire? That would actually be pretty useful.

Great job to ExtendeD once again!

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #3 on: February 17, 2012, 12:01:14 am »
Hey that's pretty awesome, keep up the good job :D

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #4 on: February 17, 2012, 12:09:20 am »
wow, cool
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #5 on: February 17, 2012, 02:07:40 am »
Just plainly epic, I can't describe how happy I am!

(Because now you can do anything with Lua, anything)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #6 on: February 17, 2012, 02:22:15 am »
Yeah, that's another major, and very interesting, development. TI chose to deprive programmers and users from such power, but the closed platform is being slowly opened, bit by bit :)

Sadly, it remains as likely as ever (unless TI strongly surprises us by performing a radical U-turn, reversing their stance of the past six-seven years) that the next OS release, in a few weeks (?), blocks completely the third iteration of Ndless, instead of taking advantage of the possibilities of native code...
« Last Edit: February 17, 2012, 06:02:53 am by adriweb »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #7 on: February 17, 2012, 05:14:40 am »
Btw you should really put download links to this in the downloads section here, even if it redirects to TI-Planet. It would still be easy to keep up to date, but also give the program more visibility. :)


We cannot redirect directly to the TI-Planet file download script, only to the TI-Planet file description page on which you can click the download button.

Indeed, we had to add a protection key for the TI-Planet downloads, as some site was trying to directly link our download script as if it was their own files ( = without mentionning us ).


Like the watermarks on our images, again, were are very sad having to do that.
« Last Edit: February 18, 2012, 04:22:06 pm by critor »
TI-Planet co-admin.

Offline sammyMaX

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 204
  • Rating: +9/-0
    • View Profile
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #8 on: February 22, 2012, 10:13:45 am »
Can we use Lua in our C code (mostly C, a little Lua)? I would like to be able to use the pretty font Lua has in my C programs.

Are you wondering who Sammy is? My avatar is Sammy.
   

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #9 on: February 22, 2012, 02:26:36 pm »
Embedding an instance of the Lua interpreter in a C program would be possible. But TI's specific Lua GUI API requires being fully integrated with the document editor, what you want to do wouldn't be possible.
Ndless.me with the finest TI-Nspire programs

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #10 on: February 22, 2012, 03:00:52 pm »
I have an idea for having an extension in the same tns file as the lua script.
TNS files still work if you cat data to the end of it, so you could do something like this:
[Lua file Data - Ndless Data - a few bytes that contain the offset of the Ndless data to the end of the file]
Maybe you could link this to the name 'self', so require 'self'

What do you think?

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Native Lua Extensions thanks to the latest Ndless update !
« Reply #11 on: February 22, 2012, 03:02:05 pm »
Interesting idea :)
Ndless.me with the finest TI-Nspire programs