Home TI-Nspire Authoring TI-Nspire Scripting HQ Scripting Tutorial - Lesson 5

           


Scripting Tutorial - Lesson 5

Download supporting files for this tutorial

Download this page in PDF format

Texas Instruments TI-Nspire Scripting Support Page

   

This lesson has no coding as such, so should be a welcome relief, especially after lesson 4! Instead, it seems like a good idea to stop and talk about some ways to apply what we have learned so far. We now know how to create and display text, and even to accept interactive input into our pages.

We will begin by looking at a template document that should make it very easy to create the sort of dynamic pages we have been learning about on the fly - without ever going near a Lua script!! Then we will look at an example which puts together pretty much everything we have learned into a dynamic quiz document.

     
     

Lesson 5.1: Lua Display Template

As discussed earlier, there are some real advantages in using Lua pages in place of Notes in documents that we wish to distribute (especially for students, who will readily get in and break what we have created!). They are secure. We have a much wider color palette and much more control over our display choices.

As you see from the movie, you can use the setup program in the template or tutorial documents to easily create your own document. Then delete all the other pages (the template document makes this easy - just ctrl-k then delete page 1.1. Then build your new document from the Lua page you have created.

Once created, this page is portable - it can be selected (ctrl-k), copied and pasted into a new document. However, it will appear blank when pasted into a new document, since there are no values for it. See the movie to see how easily you can define the contents for your lines and even the style features for your page.

You may also like to study the document lua_display_template1.tns and the accompanying script for the first display page, lua_display.lua. A different and more general approach is used here, allowing multiple pages of lua text: instead of a setup program, we use a spreadsheet, into which the user adds the lines for each page, followed by the page attributes. See how this is achieved.

 

Of course, if you have completed the previous lessons in this series, you could also go into the Lua script page (multi_template.lua and lua_display.lua) and explore the ways that this document was created. Then use these to build your own!

     
     

Lesson 5.2: Putting it All Together

The document which is shown here is one example of how the various aspects of what we have learned might be used to advantage. It is NOT offered as a particularly good pedagogical example, but rather as a proof of concept to illustrate what is possible using these techniques.

The title page is defined by the script title_page.lua and the quiz page by algquiz.lua.

This document uses the Polynomial Toolkit. You may note that as you type in an algebraic expression, it is automatically formatted as you type. The variable is picked up by Lua, sent back to TI-Nspire to be formatted using the xpress function, then back to Lua for display!

 
     
     

Hope that was helpful!

The next few lessons will look at Lua's graphics capabilities, including the use of images.

           

Home TI-Nspire Authoring TI-Nspire Scripting HQ Scripting Tutorial - Lesson 5