π
<-
Chat plein-écran
[^]

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

Message non lude nspiredev500 » 03 Juil 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.
Fichiers joints
io.luax.tns
(87.32 Kio) Téléchargé 98 fois
os.luax.tns
(109.24 Kio) Téléchargé 92 fois
Avatar de l’utilisateur
nspiredev500
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 16%
 
Messages: 17
Inscription: 03 Juil 2020, 12:22
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile
GitHub: nspiredev500

Re: I recreated the io and os modules using Ndless

Message non lude Adriweb » 03 Juil 2020, 20:58

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

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...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80%
 
Messages: 14599
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: I recreated the io and os modules using Ndless

Message non lude Ti64CLi++ » 03 Juil 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
Avatar de l’utilisateur
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 32.3%
 
Messages: 3441
Images: 75
Inscription: 04 Juil 2014, 14:40
Localisation: Clermont-Ferrand 63
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: ENS Rennes
GitHub: Ti64CLi


Retourner vers Nspire-Lua

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 4 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
824 utilisateurs:
>798 invités
>20 membres
>6 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)