Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 June, 2013, 12:51:32 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2   Go Down
  Print  
Author Topic: Getting started with Lua on Nspire -  (Read 1803 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
hellninjas
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 31 May, 2013, 02:16:24
Date Registered: 12 May, 2011, 02:15:30
Location: USA
Posts: 617


Topic starter
Total Post Ratings: +17

View Profile
« on: 30 December, 2011, 06:57:49 »
0

Okay, I would like to learn how to code Lua on an nspire!
My OS is 3.1.0.392
I would really like to learn how to make menu's...
Also making pictures... and many moar things in Lua!
Please help!
Thanks!
« Last Edit: 30 December, 2011, 07:29:31 by hellninjas » Logged

willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 01:57:19
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2652


Total Post Ratings: +65

View Profile
« Reply #1 on: 30 December, 2011, 07:07:18 »
0

No menus on the nspire
XXX->Varname (up to 16 chars IIRC) and that can be literally anything from matrices to strings to ints to floats
no way to display pics directly. Plotting points can be a method that takes forever. Also, there's no output command.

The best way I've found to do any sort of proper display method was the text box, or regular disp with matrices.

You should also become VERY familiar with the string commands:

Left()
Mid()
right()
str & str
instring()

See the nspire catalog for a syntax example. Left takes a number of chars starting from the left of a string and returns that substring. same goes for right. Mid is identical to the 84+ sub(). & is the equivalent of str+str in 84+ basic. Instring finds the position of one string inside of another, and returns a particular int (0 I think) if it doesn't find any. It gives the first one then stops, so multiples are undetected.

request and requeststr are the only ways of getting in-prog input, but there are also inline args when you run the program. ex. prog(a,b,c) where a b and c are vars of any type that become vars in your program.

Local var is a great way of avoiding variable collisions between progs, it makes it so a var doesn't affect a var by the same name outside the program. Example:

Out of program:
6->a

in program:
local a
"hello"->a
end program:

disp a
 - Returns 6

No way to exit PTT from basic Tongue that's one of the many uses for ndless. besides, you can't run basic progs from within PTT anyways, unless you make them on the spot.

I probably got one or two things wrong, but that's about as far as BASIC can go while remaining inside one program. If you're not afraid of using multiple programs
« Last Edit: 30 December, 2011, 07:09:36 by willrandship » Logged

hellninjas
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 31 May, 2013, 02:16:24
Date Registered: 12 May, 2011, 02:15:30
Location: USA
Posts: 617


Topic starter
Total Post Ratings: +17

View Profile
« Reply #2 on: 30 December, 2011, 07:12:37 »
0

No menu's eh?
Ndless it is...
Is there an Ndless for OS 3.1.0.392?
Logged

willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 01:57:19
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2652


Total Post Ratings: +65

View Profile
« Reply #3 on: 30 December, 2011, 07:14:55 »
+1

not yet Wink but there's already a closed beta, so it can't be very far off.

Have you considered Lua? It's much better, being a real language and all. Not to mention faster. AND it can be programmed on-calc if you send the right progs.
Logged

hellninjas
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 31 May, 2013, 02:16:24
Date Registered: 12 May, 2011, 02:15:30
Location: USA
Posts: 617


Topic starter
Total Post Ratings: +17

View Profile
« Reply #4 on: 30 December, 2011, 07:17:03 »
0

How would I do this? It sounds like a nice idea Cheesy
Nice Prof Pic btw... xD
Logged

willrandship
Omnimagus of the Multi-Base.
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 01:57:19
Date Registered: 11 April, 2010, 03:08:32
Location: Between Venus and Mars
Posts: 2652


Total Post Ratings: +65

View Profile
« Reply #5 on: 30 December, 2011, 07:21:35 »
0

hehe yeah...Tongue

TI was nice and gave us Lua to use on OSes above 2.1. I don't know much about it, but there's a ton of people on this forum who do (I stuck to 2.1 so I could keep ndless, but with ndless 3 I'll switch)

Also, you actually posted in the Lua subforum Tongue Change the title to "Getting started with Lua" or something similar and you'll be all set.
Logged

hellninjas
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 31 May, 2013, 02:16:24
Date Registered: 12 May, 2011, 02:15:30
Location: USA
Posts: 617


Topic starter
Total Post Ratings: +17

View Profile
« Reply #6 on: 30 December, 2011, 07:31:18 »
0

Done!
Thankx for teh reccomendation!
I can't wait for Lua! Cheesy
Logged

jwalker
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 16 June, 2013, 15:19:18
Date Registered: 20 December, 2011, 00:20:52
Location: its cold outside
Posts: 617


Total Post Ratings: +12

View Profile
« Reply #7 on: 30 December, 2011, 07:55:18 »
0

to make pictures, you can use all of the drawing commands, or you can convert a pic to a ti.image although this is realy large and re-drawing the screen will slow down
to make a menu...if you ever read the tibasicdev article on making custom menus thats basicly what you would have to do it in lua, as there isnt a
"Menu(" command
Lua is realy easy to learn everything is event/function based
Lua example:

1
2
3
4
5
function on.paint(gc)
    gc:setColorRGB(0, 0, 0)--set the color to black
    gc:drawRect(3, 3, 50, 50)--draws a rectangle on the screen with black lines
    gc:fillRect(100, 0, 50, 50)--makes a rectangle that is filled with the color black
end
to find some tutorials go to: http://www.inspired-lua.org/
to get the official scripting tools go to: http://education.ti.com/educationportal/sites/US/nonProductSingle/nspire-scripting.html
Logged


My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!


Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 05:17:46
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2181


Total Post Ratings: +122

View Profile
« Reply #8 on: 30 December, 2011, 07:57:17 »
0

I can't wait for Lua! Cheesy
Why wait? Tongue

Also, can you make sprites in lua?
« Last Edit: 30 December, 2011, 08:00:22 by epic7 » Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   40%         Paused

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
jwalker
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 16 June, 2013, 15:19:18
Date Registered: 20 December, 2011, 00:20:52
Location: its cold outside
Posts: 617


Total Post Ratings: +12

View Profile
« Reply #9 on: 30 December, 2011, 08:15:33 »
0

you could make sprites, i would suggest using classes, but you would have to use one of the two methods i talked about above for drawing them
Logged


My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!


Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 09:26:08
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1736


Total Post Ratings: +180

View Profile WWW
« Reply #10 on: 30 December, 2011, 11:15:30 »
0

There is TI.Image, no need to create your own routine for that.
You just need img=image.new(data) to create the sprite, and gc:drawImage(img,x,y) to draw it.

Edit, misunderstood your previous post. TI.Image isn't to slow if you use it wisely Wink
« Last Edit: 30 December, 2011, 11:17:00 by jimbauwens » Logged

adriweb
Editor
LV9 Veteran (Next: 1337)
*
Offline Offline

Gender: Male
Last Login: 14 June, 2013, 17:56:38
Date Registered: 13 April, 2011, 18:42:59
Location: South of France
Posts: 1202


Total Post Ratings: +186

View Profile WWW
« Reply #11 on: 30 December, 2011, 11:38:53 »
0

and it will be even faster soon Wink
Logged


TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation
jwalker
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 16 June, 2013, 15:19:18
Date Registered: 20 December, 2011, 00:20:52
Location: its cold outside
Posts: 617


Total Post Ratings: +12

View Profile
« Reply #12 on: 30 December, 2011, 17:52:07 »
0

well thats good to know that it will be faster and i wasnt that clear either, i should have put in my post the larger they are- the more that everything lags when its redrawing
Logged


My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!


Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads
hellninjas
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 31 May, 2013, 02:16:24
Date Registered: 12 May, 2011, 02:15:30
Location: USA
Posts: 617


Topic starter
Total Post Ratings: +17

View Profile
« Reply #13 on: 30 December, 2011, 21:06:54 »
0

I see alot of people coding on the computer and transfering to the calc, but how would I program ON-Calc ?
Logged

cyanophycean314
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 19:28:34
Date Registered: 07 December, 2011, 02:44:32
Location: Somewhere?
Posts: 363


Total Post Ratings: +42

View Profile
« Reply #14 on: 30 December, 2011, 22:40:55 »
0

You can use the default notes application and then copy and paste to oclua or you can use LuaCS and copy to paste to Oclua.

For on-calc sprites, you can use Chockosta's nSpaint.

You can't really get .tns oncalc, at least I don't think so...
« Last Edit: 30 December, 2011, 22:41:49 by cyanophycean314 » Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.256 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.