π
<-

I recreated the io and os modules using Ndless

Pour TI-Nspire OS 3.0 ou ultérieur.

I recreated the io and os modules using Ndless

Unread postby nspiredev500 » 03 Jul 2020, 20:39

Hi,
I don't know whether to post this in the native forum or the Lua forum, but I think it is more usefull to the Lua people.
I'm working on Lua and C interaction for the Nspire now and I thought while I'm at it, I could implement the missing Lua modules.
This means you need Ndless to use these modules.
A few functions are currently unimplemented or are unimplemented because they make no sense on the calculator.
os.exit, os.getenv and os.setlocale make no sense the way TI-Lua is implemented.
io.popen cannot be implemented because there are no pipes on the Nspire.
io.lines, io.tmpfile and os.tmpfile are not implemented by me right now.
io.read only supports reading raw bytes in up to 4K chunks.

I'll add the unsupported functions later, but it should be good for now.
To make debugging easier for me, the io functions don't return an error string, but just error. This way you can always see the error
The io library should be working, but I haven't tested it that much. It should always close files when the app is closed or the file object is garbage-collected.
If a file is already open for writing and you try to open it a second time, it will error. If you app didn't open it 2 times, then my library didn't close the file the last time.
Pressing the reset button will close all open files.

To use the libraries, install the correct Ndless version for you OS. Then transfer the io.luax.tns and os.luax.tns files to your calculator.
To use them in a script, use:
nrequire "io"
nrequire "os"

The source code is on Github.
Have fun with the Lua os and io modules.
You do not have the required permissions to view the files attached to this post.
User avatar
nspiredev500
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 16%
 
Posts: 17
Joined: 03 Jul 2020, 12:22
Gender: Not specified
Calculator(s):
MyCalcs profile
GitHub: nspiredev500

Re: I recreated the io and os modules using Ndless

Unread postby Adriweb » 03 Jul 2020, 20:58

Nice job :)
Levak did that as well for earlier versions, many years ago :p

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 79.9%
 
Posts: 14836
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: I recreated the io and os modules using Ndless

Unread postby Ti64CLi++ » 03 Jul 2020, 22:32

Nice job indeed :bj:
It's true that some of them are very useful and were missing.
File related functions are particularly welcomed ^^
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.5%
 
Posts: 3446
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi


Return to Nspire-Lua

Who is online

Users browsing this forum: ClaudeBot [spider] and 3 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1185 utilisateurs:
>1173 invités
>6 membres
>6 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)