Author Topic: My first lua program  (Read 6448 times)

0 Members and 1 Guest are viewing this topic.

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
My first lua program
« on: August 18, 2012, 05:26:51 pm »
After a while of switching between which language to learn next I have decided to try lua, this is my first program in lua it isnt anything spectacular but it is a start  :D I hope luna compiled it correctly (I used oclua)

EDIT: no it isnt Hello world
« Last Edit: August 18, 2012, 05:42:04 pm by annoyingcalc »
This used to contain a signature.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: My first lua program
« Reply #1 on: August 18, 2012, 06:22:51 pm »
Nice :)

Next step for you I guess is that you may want to use classes for creating more objects of the same type (instances of the class). Here's it's two objects so it's good enough not to use classes anyway.

Also I guess I don't see any indentation because it's not done on the computer ? (oclua / Luna, I'm not sure what you used ?)

Anyway, you can have the Nspire Software 3.2 while having your calc in 3.1 if you want to keep it so, and then you'll be able to profit from the Lua SDK inside the software which is much better than on-calc for longer scripts.

Don't forget to visit Inspired-Lua.org :D
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: My first lua program
« Reply #2 on: August 18, 2012, 06:25:44 pm »
Also I guess I don't see any indentation because it's not done on the computer ? (oclua / Luna, I'm not sure what you used ?
right I am using my computer in the future though
Quote
Don't forget to visit Inspired-Lua.org :D
That is where ive been going :D
This used to contain a signature.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: My first lua program
« Reply #3 on: August 18, 2012, 09:54:48 pm »
Nice, what kind of things do you plan on makeing?
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: My first lua program
« Reply #4 on: August 18, 2012, 10:03:50 pm »
Games, not sure what games yet.
This used to contain a signature.

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: My first lua program
« Reply #5 on: August 19, 2012, 10:45:05 am »
Interesting program. You could probably turn this into some puzzle game where you have to navigate through mazes on both sides of the field and there're switches one person activates to help another.

Good to see another Lua coder!  :)

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: My first lua program
« Reply #6 on: August 19, 2012, 11:39:04 pm »
Yes, that is my plan for this!
This used to contain a signature.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: My first lua program
« Reply #7 on: August 20, 2012, 12:11:32 am »
EDIT: no it isnt Hello world

But there are no Hello World for the TI-Nspire yet. We need one! O.O

Just kidding I'll have to try your program when I have time. :)  Is OS 3.2 absolutely required or will I be fine with 3.1? I have Ndless...
« Last Edit: August 20, 2012, 12:11:39 am by DJ_O »

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: My first lua program
« Reply #8 on: August 20, 2012, 12:19:51 am »
I use 3.1
This used to contain a signature.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: My first lua program
« Reply #9 on: August 20, 2012, 12:26:17 am »
You can make 3.2 programs completely compatible with 3.1 ones
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: My first lua program
« Reply #10 on: August 20, 2012, 01:14:07 am »
You can make 3.2 programs completely compatible with 3.1 ones
Indeed.
Either if you have only one script frame in your .tns (and you never had anything more than that - even if deleted) then you have to put " platform.apilevel = '1.0' " at the beginning of your script.
You can also use Luna
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: My first lua program
« Reply #11 on: August 20, 2012, 10:42:21 pm »
You can make 3.2 programs completely compatible with 3.1 ones
Oh I meant for example if he decided to use the 3.2-only physic engine or commands. On the TI-84+ I remember people tried to make their games 83+ compatible, but some others forgot that the 83+ had no clock, so people complained that their games won't send to a 83+ because it uses the clock.

Offline annoyingcalc

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1953
  • Rating: +140/-72
  • Found in Eclipse.exe
    • View Profile
Re: My first lua program
« Reply #12 on: August 20, 2012, 11:30:52 pm »
Oh, I only use 3.1 I want gpsp :D
This used to contain a signature.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: My first lua program
« Reply #13 on: August 21, 2012, 10:21:52 am »
You can make 3.2 programs completely compatible with 3.1 ones
Oh I meant for example if he decided to use the 3.2-only physic engine or commands. On the TI-84+ I remember people tried to make their games 83+ compatible, but some others forgot that the 83+ had no clock, so people complained that their games won't send to a 83+ because it uses the clock.
That would make it incompatible, so would using withGC. But since he is using 3.1, He shouldnt have to realy worry about anything other than using setAlpha, platform.gc, the clipRect command "intersect", and there may be a few others and I just dont remember them. Those commands that I just listed will not work on OS 3.2
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: My first lua program
« Reply #14 on: August 21, 2012, 01:36:22 pm »
As far as I know, they will work if you have "platform.apiLevel = '1.0'".
Don't know about setAlpha though. But that command wasn't even supported and did not work properly on calc.