Author Topic: Starting Nspire Lua  (Read 3369 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Starting Nspire Lua
« on: June 13, 2011, 04:52:21 pm »
I just got OS 3 and tried a few Lua games and it was OK so I wanted to make some Lua games too.

There don't seem to be many articles on how to start on Lua, nor an SDK. So, can someone give me some starting tips.

What I need:
  • A Lua>TNS for Linux, a good one you recommend, since there are several (or so I think)
  • Hello World code please?
  • Routines

What I mean with routines is: are there pre-defined TI-Made Routines to display images and get key input? That sort of stuff that is not in Console Lua, but there should be in Nspire Lua.

Thanks a lot!

EDIT: Oh and I forgot, I know console Lua already :)
« Last Edit: June 13, 2011, 04:54:26 pm by Scout »

Offline hoffa

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: Starting Nspire Lua
« Reply #1 on: June 13, 2011, 05:10:44 pm »
Just use the official tool: http://education.ti.com/calculators/downloads/US/Software/Download/en/6840/7896/TI-NspireScriptingTools.zip

Hello world:
Code: [Select]
function on.paint(gc)
    gc:drawString("Hello world!", 0, 0, "top")
end

Here's the documentation for the built-in Nspire functions: http://education.ti.com/downloads/guidebooks/ti-nspire/scripting/TI-NspireScriptingInterface.pdf

It's just stripped-down Lua with some added functions, so it shouldn't be new to you.

If you want sprites, you'll have to convert the images to a special string sequence (their so-called TI.Image format). You can use the 'official' converter (the image serialization button on their scripting tools).
« Last Edit: June 13, 2011, 05:21:45 pm by hoffa »

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Starting Nspire Lua
« Reply #2 on: June 14, 2011, 02:45:29 am »
Just use the official tool: http://education.ti.com/calculators/downloads/US/Software/Download/en/6840/7896/TI-NspireScriptingTools.zip
Does that one support Linux? In the past, TI hasn't seemed to care about those who use the anything other than Windows and Mac OS X...

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Starting Nspire Lua
« Reply #3 on: June 14, 2011, 03:07:00 am »
It doesn't, unless you use wine ... but that has no use since you need the nspire software installed.
I recommend the Lue2TNS of Debrouxl, Adriweb and ExtendeD. I use it constantly, and it works perfect :)

To grasp the basic of Nspire Lua, I recommend you to read this : http://www.inspired-lua.org/2011/05/concepts-and-basics/ and other tutorials on inspired-lua.org

Edit: didn't see that hoffa posted a hello world :p
« Last Edit: June 14, 2011, 03:08:11 am by jimbauwens »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Starting Nspire Lua
« Reply #4 on: June 19, 2011, 12:55:04 pm »
Hum, thanks you all. I finally set up my IDE in Linux and everything is very nice :D