π
<-

How do I use myLib?

Pour TI-Nspire OS 3.0 ou ultérieur.

How do I use myLib?

Unread postby chalex0 » 23 Jul 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 :)
User avatar
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 96%
 
Posts: 18
Joined: 22 May 2021, 19:54
Location: UK
Gender: Male
Calculator(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Unread postby Adriweb » 23 Jul 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.

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: 14838
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: How do I use myLib?

Unread postby chalex0 » 23 Jul 2022, 00:54

Adriweb wrote: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 :(
User avatar
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 96%
 
Posts: 18
Joined: 22 May 2021, 19:54
Location: UK
Gender: Male
Calculator(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Unread postby Adriweb » 23 Jul 2022, 14:02

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

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: 14838
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: How do I use myLib?

Unread postby chalex0 » 24 Jul 2022, 23:34

Adriweb wrote: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 :/
You do not have the required permissions to view the files attached to this post.
User avatar
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 96%
 
Posts: 18
Joined: 22 May 2021, 19:54
Location: UK
Gender: Male
Calculator(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Unread postby Adriweb » 26 Jul 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.

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: 14838
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: How do I use myLib?

Unread postby chalex0 » 26 Jul 2022, 15:10

Adriweb wrote: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
User avatar
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 96%
 
Posts: 18
Joined: 22 May 2021, 19:54
Location: UK
Gender: Male
Calculator(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Unread postby Adriweb » 26 Jul 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

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: 14838
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: How do I use myLib?

Unread postby chalex0 » 26 Jul 2022, 23:19

Adriweb wrote: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.
User avatar
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 96%
 
Posts: 18
Joined: 22 May 2021, 19:54
Location: UK
Gender: Male
Calculator(s):
MyCalcs profile
YouTube: onlypuppy7

Re: How do I use myLib?

Unread postby Adriweb » 28 Jul 2022, 09:32

I'm not really sure - I would try events like on.deactivate/activate, and using the latest apilevel... ?

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: 14838
Images: 1131
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb


Return to Nspire-Lua

Who is online

Users browsing this forum: ClaudeBot [spider] and 10 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.
2304 utilisateurs:
>2261 invités
>34 membres
>9 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)