How do I use myLib?
Voir le premier message non lu • 10 messages
• Page 1 sur 1
How do I use myLib?
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
-
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)- Messages: 17
- Inscription: 22 Mai 2021, 19:54
- Localisation: UK
- Genre:
- Calculatrice(s):→ MyCalcs profile
- YouTube: onlypuppy7
Re: How do I use myLib?
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.
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...)-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Messages: 14656
- Images: 1118
- Inscription: 01 Juin 2007, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Twitter/X: adriweb
- GitHub: adriweb
Re: How do I use myLib?
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
-
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)- Messages: 17
- Inscription: 22 Mai 2021, 19:54
- Localisation: UK
- Genre:
- Calculatrice(s):→ MyCalcs profile
- YouTube: onlypuppy7
Re: How do I use myLib?
What exactly are you stuck on?
You can download the .tns and look at the Basic part, too.
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...)-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Messages: 14656
- Images: 1118
- Inscription: 01 Juin 2007, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Twitter/X: adriweb
- GitHub: adriweb
Re: How do I use myLib?
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é 46 fois
-
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)- Messages: 17
- Inscription: 22 Mai 2021, 19:54
- Localisation: UK
- Genre:
- Calculatrice(s):→ MyCalcs profile
- YouTube: onlypuppy7
Re: How do I use myLib?
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.
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...)-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Messages: 14656
- Images: 1118
- Inscription: 01 Juin 2007, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Twitter/X: adriweb
- GitHub: adriweb
Re: How do I use myLib?
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 now it all makes so much more sense
ps. I wanted to also mention inspired lua is down
-
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)- Messages: 17
- Inscription: 22 Mai 2021, 19:54
- Localisation: UK
- Genre:
- Calculatrice(s):→ MyCalcs profile
- YouTube: onlypuppy7
Re: How do I use myLib?
Oh yeah refreshing the libs is needed...
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
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
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: 14656
- Images: 1118
- Inscription: 01 Juin 2007, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Twitter/X: adriweb
- GitHub: adriweb
Re: How do I use myLib?
Adriweb a écrit:Oh yeah refreshing the libs is needed...
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
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.
-
chalex0Programmeur
Niveau 4: MC (Membre Confirmé)- Messages: 17
- Inscription: 22 Mai 2021, 19:54
- Localisation: UK
- Genre:
- Calculatrice(s):→ MyCalcs profile
- YouTube: onlypuppy7
Re: How do I use myLib?
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...)-
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)- Messages: 14656
- Images: 1118
- Inscription: 01 Juin 2007, 00:00
- Localisation: France
- Genre:
- Calculatrice(s):→ MyCalcs profile
- Twitter/X: adriweb
- GitHub: adriweb
10 messages
• Page 1 sur 1
Qui est en ligne
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 15 invités