Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: Munchor on June 13, 2011, 04:52:21 pm

Title: Starting Nspire Lua
Post by: Munchor 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:

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 :)
Title: Re: Starting Nspire Lua
Post by: hoffa 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 (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 (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).
Title: Re: Starting Nspire Lua
Post by: JosJuice 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 (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...
Title: Re: Starting Nspire Lua
Post by: Jim Bauwens 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
Title: Re: Starting Nspire Lua
Post by: Munchor 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