Author Topic: Lua Q&A  (Read 104270 times)

0 Members and 3 Guests are viewing this topic.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Lua Q&A
« Reply #90 on: August 29, 2011, 06:36:35 pm »
Yup, I put it in on.paint(gc).

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Lua Q&A
« Reply #91 on: August 29, 2011, 06:38:43 pm »
Talking about sleep(), its relatively easy to implant by mixing a coroutine and the timer. sleep can be kinda usefull for people making a text adventure :)
I'd be curious to see that code :P


and @pianoman : you never call cursor.hide() ?
« Last Edit: August 29, 2011, 06:39:10 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Q&A
« Reply #92 on: August 29, 2011, 07:48:24 pm »
TI-Nspire ClickPad ?

As I remember my first tests, it was impossible to show the cursor on ClickPad
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Lua Q&A
« Reply #93 on: August 29, 2011, 09:28:50 pm »
@Adriweb: Nope, never.
@Levak: Yes, I have that, but in other programs, like Towers of Hanoi, the cursor works... could I just make my own cursor and have it move around when the mouse is used?

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Q&A
« Reply #94 on: August 29, 2011, 10:26:02 pm »
Ok, so it seems that putting a cursor.show in on.create() and on.resize does it...
I can't test right now.
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Lua Q&A
« Reply #95 on: August 29, 2011, 10:28:51 pm »
Putting it in both?
Ok, I'll test that once I finish my vocab homework :P

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Lua Q&A
« Reply #96 on: August 30, 2011, 03:00:45 am »
... could I just make my own cursor and have it move around when the mouse is used?
Yes, I think that might be possible, hiding the real one and showing yours.

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Lua Q&A
« Reply #97 on: August 30, 2011, 10:50:04 pm »
Ok, so it seems that putting a cursor.show in on.create() and on.resize does it...
I can't test right now.
Nope, nothing. :(

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Q&A
« Reply #98 on: September 03, 2011, 04:05:51 am »
Levak ?

Thanks.
TNOC 1.22 I released today fixes thoses memory bugs =)
And also it finaly renames correctly files \o/

http://tiplanet.org/forum/archives_voir.php?id=1922 (same link as before)
« Last Edit: September 03, 2011, 04:06:52 am by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Sebasu

  • LV2 Member (Next: 40)
  • **
  • Posts: 31
  • Rating: +0/-0
    • View Profile
Re: Lua Q&A
« Reply #99 on: October 03, 2011, 07:21:04 pm »
Hello I'm starting with lua, i have a curious problem:
my code:
function on.paint(gc)
    gc:drawString("Vagos CORP®", 5, 25)
    gc:drawString("Organisación Industrial", 5, 45)
    gc:drawString("Desarrollado por Sebasu", 5, 205)
end
when I copy to oclua it works perfectly but when i save the oclua file and exit, the compiled program dissapears of the screen in the file.
when I use the TI-Scriping Tool and paste the generated code, the TI-Soft close inmediately.
when I use luna 0.2a it generates te .tns file but when i open the file:  "3: ')' expected near 'Organisaci36'"
With one hour testing, I think that the simbols "®" and "ó" are the problem but I need this simbols working
how can i do that?
and what is the real problem?
thanks for help
and luna 0.2a can be downloaded from here http://ndlessly.wordpress.com/

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Lua Q&A
« Reply #100 on: October 03, 2011, 10:14:00 pm »
Hi!
Okay, this might seem a bit complex, but its actually pretty simple.
1. Go to Scratchpad and type in ord("®"). Record the number it outputs, then repeat for "ó".
2. To get those strings, you will need to do this:
Code: [Select]
a="Vagos CORP"..math.eval("char(whatever number ® output)")
b="Organisaci"..math.eval("char(the output from ó)").."n Industrial"

Now you can just print those strings like this:
Code: [Select]
function on.paint(gc)
    gc:drawString(a,5, 25)
    gc:drawString(b, 5, 45)
    gc:drawString("Desarrollado por Sebasu", 5, 205)
end
That's it (I think :))

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Lua Q&A
« Reply #101 on: October 04, 2011, 11:09:26 am »
You can also use:
gc:drawString("Vagos CORP" .. string.char(the number returned by ord))
I'm not sure what's wrong with oclua and the TI-Nspire Scriping Tools. But a problem was already reported with Luna v0.2 when converting special characters, I'll look into it.
Ndless.me with the finest TI-Nspire programs

Offline Sebasu

  • LV2 Member (Next: 40)
  • **
  • Posts: 31
  • Rating: +0/-0
    • View Profile
Re: Lua Q&A
« Reply #102 on: October 04, 2011, 03:38:28 pm »
wow so interesting, pianoman it works perfectly!!!
the ExtendeD's Solution was logic but when execute the generated file, it show me random "unicode" simbols, i don't know if is a compiler problem or the algorithm need to be corrected
thanks for help
luna0.2a still has bugs and with the TI-Scriping Tool can be compiled, but large programs can't be pasted in the TI-Soft or in oclua (too big for the memory)
it's so frustrating!!!!!

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Q&A
« Reply #103 on: October 04, 2011, 04:06:07 pm »
string.uchar() I guess ?
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Sebasu

  • LV2 Member (Next: 40)
  • **
  • Posts: 31
  • Rating: +0/-0
    • View Profile
Re: Lua Q&A
« Reply #104 on: October 05, 2011, 12:59:27 am »
wow amazing!!!
and it correct an error compiling in luna my large code with this chars
thanks for help Levak