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.
I recreated the io and os modules using Ndless
Voir le premier message non lu • 3 messages
• Page 1 sur 1
I recreated the io and os modules using Ndless
- Fichiers joints
-
- io.luax.tns
- (87.32 Kio) Téléchargé 100 fois
-
- os.luax.tns
- (109.24 Kio) Téléchargé 94 fois
Lua io and os libraries: https://github.com/nspiredev500/nspire-lua
OSExt: https://github.com/nspiredev500/OSExt
n-as on-calc assembler: https://github.com/nspiredev500/nspire- ... g/n-asv1.0
OSExt: https://github.com/nspiredev500/OSExt
n-as on-calc assembler: https://github.com/nspiredev500/nspire- ... g/n-asv1.0
-
nspiredev500
Niveau 4: MC (Membre Confirmé)- Messages: 17
- Inscription: 03 Juil 2020, 12:22
- Genre:
- Calculatrice(s):→ MyCalcs profile
- GitHub: nspiredev500
Re: I recreated the io and os modules using Ndless
Nice job
Levak did that as well for earlier versions, many years ago
Levak did that as well for earlier versions, many years ago
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...)-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Messages: 14616
- Images: 1218
- Inscription: 01 Juin 2007, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Twitter/X: adriweb
- GitHub: adriweb
Re: I recreated the io and os modules using Ndless
Nice job indeed
It's true that some of them are very useful and were missing.
File related functions are particularly welcomed
It's true that some of them are very useful and were missing.
File related functions are particularly welcomed
-
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)- Messages: 3441
- Images: 75
- Inscription: 04 Juil 2014, 14:40
- Localisation: Clermont-Ferrand 63
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Classe: ENS Rennes
- GitHub: Ti64CLi
3 messages
• Page 1 sur 1
Qui est en ligne
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 10 invités