π
<-
Chat plein-écran
[^]

How do I use myLib?

Pour TI-Nspire OS 3.0 ou ultérieur.

How do I use myLib?

Message non lude chalex0 » 23 Juil 2022, 00:37

I want to use myLib for the purposes of recalling strings or tables, as a separately updateable package to my main program. I have looked at some programs that use it but I'm too silly to understand what is going on, could somebody point me towards myLib lua references/documentation or provide a brief explanation on how to achieve this? Thanks :)
Avatar de l’utilisateur
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 17
Inscription: 22 Mai 2021, 19:54
Localisation: UK
Genre: Homme
Calculatrice(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Message non lude Adriweb » 23 Juil 2022, 00:39

Here's an example : https://github.com/adriweb/EEPro-for-Ns ... tabase.lua :)
The called Basic functions must in this case return lua code, since it's executed with loadstring.
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.1%
 
Messages: 14606
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: How do I use myLib?

Message non lude chalex0 » 23 Juil 2022, 00:54

Adriweb a écrit:Here's an example : https://github.com/adriweb/EEPro-for-Ns ... tabase.lua :)
The called Basic functions must in this case return lua code, since it's executed with loadstring.

I had seen this before but sadly I didn't get how to implement it myself :(
Avatar de l’utilisateur
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 17
Inscription: 22 Mai 2021, 19:54
Localisation: UK
Genre: Homme
Calculatrice(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Message non lude Adriweb » 23 Juil 2022, 14:02

What exactly are you stuck on?
You can download the .tns and look at the Basic part, too.
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.1%
 
Messages: 14606
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: How do I use myLib?

Message non lude chalex0 » 24 Juil 2022, 23:34

Adriweb a écrit:What exactly are you stuck on?
You can download the .tns and look at the Basic part, too.

Hi, I've progressed my understanding that now I know I can store and recall within just Lua, as this is what Minecraft 2D uses; it appears to be different but I am no expert.

For example, to retrieve content it uses this:
var.recall("test\\content")

I am, however stuck on how to actually embed/store this information within the tns file. I have tried var.store("test","x") but this for some reason cannot be recognised as being a library thing. I'm also unable to remove anything by setting it to nil. I've included the file I have been playing with, it uses the database from mc2d as a base, and the pre existing var "content" is recognised while "test" does not. This probably stems from unfamiliarity with storing variables in general :/
Fichiers joints
test.tns
(5.21 Kio) Téléchargé 38 fois
Avatar de l’utilisateur
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 17
Inscription: 22 Mai 2021, 19:54
Localisation: UK
Genre: Homme
Calculatrice(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Message non lude Adriweb » 26 Juil 2022, 11:45

You can't use the "foo\\bar" syntax for var.recall/store, that gives nil, and the error message "cannot recall variable test\content". Indeed this API is just for storing/retrieving variables from the same document. While foo\bar is the syntax for retrieving the bar public variable in a MyLib document called foo.
I don't know what Minecraft2D uses, but in the case of FormulaPro, what I did is create a public basic function that returns lua code, so that I can math.eval it (with the backslash syntax) and then execute the code.
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.1%
 
Messages: 14606
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: How do I use myLib?

Message non lude chalex0 » 26 Juil 2022, 15:10

Adriweb a écrit:You can't use the "foo\\bar" syntax for var.recall/store, that gives nil, and the error message "cannot recall variable test\content". Indeed this API is just for storing/retrieving variables from the same document. While foo\bar is the syntax for retrieving the bar public variable in a MyLib document called foo.
I don't know what Minecraft2D uses, but in the case of FormulaPro, what I did is create a public basic function that returns lua code, so that I can math.eval it (with the backslash syntax) and then execute the code.

Thanks for this advice, I know what caused the issue before, and I hate to admit that I hadn't refreshed the libraries when trying your implementation :sob: now it all makes so much more sense

ps. I wanted to also mention inspired lua is down :p
Avatar de l’utilisateur
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 17
Inscription: 22 Mai 2021, 19:54
Localisation: UK
Genre: Homme
Calculatrice(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Message non lude Adriweb » 26 Juil 2022, 15:43

Oh yeah refreshing the libs is needed... :P

And yeah, Inspired-Lua has been taken down temporarily while we try to fix what seems to be a WordPress issue. I'll check (again...) if there's a way for me to just make it static, no more Wordpress :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.1%
 
Messages: 14606
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: How do I use myLib?

Message non lude chalex0 » 26 Juil 2022, 23:19

Adriweb a écrit:Oh yeah refreshing the libs is needed... :P

And yeah, Inspired-Lua has been taken down temporarily while we try to fix what seems to be a WordPress issue. I'll check (again...) if there's a way for me to just make it static, no more Wordpress :p

Yeah really dumb mistake on my part #_#. I do want to ask about something else that has bugged me for some time, when using timer (in lua) if I turn off and on the calc the whole problem freezes (the screen only updates if the focus changes). It is only mitigated by manually switching off the timer before turning off, and then turning the timer back on again. Do you know of any way to solve this, like automatically turning off timer? I tried various events but they don't do much.
Avatar de l’utilisateur
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 17
Inscription: 22 Mai 2021, 19:54
Localisation: UK
Genre: Homme
Calculatrice(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Message non lude Adriweb » 28 Juil 2022, 09:32

I'm not really sure - I would try events like on.deactivate/activate, and using the latest apilevel... ?
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.1%
 
Messages: 14606
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb


Retourner vers Nspire-Lua

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 6 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.
998 utilisateurs:
>982 invités
>11 membres
>5 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)