Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: annoyingcalc on August 18, 2012, 05:26:51 pm

Title: My first lua program
Post by: annoyingcalc 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
Title: Re: My first lua program
Post by: Adriweb 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
Title: Re: My first lua program
Post by: annoyingcalc 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
Title: Re: My first lua program
Post by: jwalker on August 18, 2012, 09:54:48 pm
Nice, what kind of things do you plan on makeing?
Title: Re: My first lua program
Post by: annoyingcalc on August 18, 2012, 10:03:50 pm
Games, not sure what games yet.
Title: Re: My first lua program
Post by: cyanophycean314 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!  :)
Title: Re: My first lua program
Post by: annoyingcalc on August 19, 2012, 11:39:04 pm
Yes, that is my plan for this!
Title: Re: My first lua program
Post by: DJ Omnimaga 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...
Title: Re: My first lua program
Post by: annoyingcalc on August 20, 2012, 12:19:51 am
I use 3.1
Title: Re: My first lua program
Post by: jwalker on August 20, 2012, 12:26:17 am
You can make 3.2 programs completely compatible with 3.1 ones
Title: Re: My first lua program
Post by: Adriweb 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
Title: Re: My first lua program
Post by: DJ Omnimaga 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.
Title: Re: My first lua program
Post by: annoyingcalc on August 20, 2012, 11:30:52 pm
Oh, I only use 3.1 I want gpsp :D
Title: Re: My first lua program
Post by: jwalker 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
Title: Re: My first lua program
Post by: Jim Bauwens 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.