Lua Quiz and Tutorials

338 views
Skip to first unread message

Stephen Arnold

unread,
Aug 1, 2011, 8:12:29 AM8/1/11
to tinspire
Hi all

I have been having a play with this wonderful Lua scripting language. There is an awful lot to learn and yet, in some respects, it is a natural extension of the scripting some of us have been learning to do within TI-Nspire. I may not be able to create exciting interactive games or even really cool simulations, but there ARE some things that become possible.

I have always considered the Notes application to be TI-Nspire's best kept secret. The power and potential within the interactive capabilities of Notes since 2.1 are limited largely by our own imaginations.

And yet, two features of Notes have been a source of some frustration to me and to others who have been pushing the envelope in this regard. While the Interactive Notes environment is an amazing medium for DISPLAYING dynamic text, it is a poor vehicle for actually having students INTERACT with that text. If we want students to change the contents of a MathBox, then they must click inside the box, exposing all the inner workings and maing it very easy to "break" whatever is intended by the teacher. Related to this is the lack of security: we have no way currently to "protect" the contents of our MathBoxes and Notes pages, so it is easy for students (and teachers) to "break" our hard-earned interactivity.

Enter Lua. A page created in Lua is secure. Students might try to click on it, but unless it has been created to do so, they cannot have any effect upon the contents. 

So I have been exploring converting all of my dynamic documents, which were built around dynamic Notes windows (and usually scatterplots in a Graph window) to Lua-based windows, replacing Notes with Lua.

It is relatively easy to replace static text and variables in this way. In fact, I have had a go at creating a template document (attached) which may allow non-programmers to convert their own Notes pages into this secure format. Suppose you have a page with 7 lines of text that you wish to convert to Lua. In my template document, run the setup program. It will ask you how many lines you need (type 7) and then prompt you to enter the contents of each line. Go to the next page and you will find your secure Lua page, ready to be copied and pasted as required.

What if you want a line of text and then a line that has some dynamic text, which is stored as a variable called, say, display. Run setup, ask for two lines, type your static text into line 1, and a question mark for line 2 ("?") to indicate a variable. the either in Calculator or Notes, store "display" as "line2": line2:=display. and you are done.

Even more interesting is the possibility for having students actually ENTER text themselves into your Lua page - remember, this is poorly done currently in Notes. In Lua, the page can be set up so that once they enter that page, any text they type is captured and can be acted upon.

I have been exploring this idea in the form of some quiz document, replacing my previous approach using calculator and a program, with a Lua page. Quiz/tutorial documents for complex numbers, completing the square and for the discriminant and the quadratic formula are also attached.

I would be very interested in feedback, suggestions, comments on these. maybe I am missing something here, but this approach seems to hold promise as possibly a better way for our students to interact with TI-Nspire documents. of course, they are still a long way from being perfect - we need to work on displaying mathematics correctly, for example. But even this may be possible.

So please feel free to have a play with the attached and if you have ideas or suggestions, or you feel I am off the track with this, place drop me a line.


--
With best wishes,
Steve
_________________
Dr Stephen Arnold
Educational Technology Consultant
Compass Learning Technologies

T3 Fellow, Teachers Teaching with Technology Australia

Office: +61-2-4232-2080
Mobile: +61-4-0175-3834
Web: http://compasstech.com.au
_________________   
lua_display_template.tns
Lua Quiz Docs.zip

Jim Fullerenex

unread,
Aug 1, 2011, 9:28:07 AM8/1/11
to tins...@googlegroups.com
A brief line of comment: really great work, thanks!
No doubt Lua has dramatically increased the interactivity of Nspire.
Best Wishes,
Jim Fullerenex



2011/8/1 Stephen Arnold <steve.co...@gmail.com>
--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
http://lafacroft.com/archive/nspire.php

Andy Kemp

unread,
Aug 1, 2011, 9:34:44 AM8/1/11
to tins...@googlegroups.com
Couldn't agree more!

What is most impressive about the Lua scripting is how well embedded
it is in the Nspire platform, and how neatly it sits alongside
everything else that exists… The fact that Steve is here using it to
display stuff that is being calculated seperately in TI-basic shows
its flexibility (as it meant Steve didn't have to rewrite get chunks
of existing ti-basic code)… The ability to pass variables back and
forth between lua and Npsire makes this a very powerful platform!

Cheers
Andy

figureloop

unread,
Aug 2, 2011, 12:01:59 AM8/2/11
to tinspire
On Aug 1, 6:34 am, Andy Kemp <a...@kemp.co> wrote:
> Couldn't agree more!
>
> What is most impressive about the Lua scripting is how well embedded
> it is in the Nspire platform, and how neatly it sits alongside
> everything else that exists…  The fact that Steve is here using it to
> display stuff that is being calculated seperately in TI-basic shows
> its flexibility (as it meant Steve didn't have to rewrite get chunks
> of existing ti-basic code)…  The ability to pass variables back and
> forth between lua and Npsire makes this a very powerful platform!
>
> Cheers
> Andy


Can Lua call the calculator's mathematical functions?

Can Lua implement mathematical functions that could be included in the
catalog, or called from the calculator application or TI-Basic
programs?

Thanks for comments!

Jim Fullerenex

unread,
Aug 2, 2011, 1:04:48 AM8/2/11
to tins...@googlegroups.com
The above questions are also what I want to ask. Besides the better graphic interactivity, will Lua enhance the mathematical capabilities?
 



2011/8/2 figureloop <cr...@sbcglobal.net>

--

Andy Kemp

unread,
Aug 2, 2011, 3:43:47 AM8/2/11
to tins...@googlegroups.com
Yes! In Lua call the math.eval(string) function where the string is
the function you want to evaluate…

At the moment however there is no way to write functions which would
live in the catalogue or be called from ti-basic etc… However
depending on what you were doing it would be possible to use
Interactive notes to have it read a particular variable from a notes
page, carry out whatever you wanted and return the output to another
variable on a Notes page… The same would work on a Calculator page it
just wouldn't tell/show you that it had updated the output variable…
Not perfect but still useful.

Jim Fullerenex

unread,
Aug 2, 2011, 3:54:00 AM8/2/11
to tins...@googlegroups.com
I'm glad to hear that. Thx
 



2011/8/2 Andy Kemp <an...@kemp.co>
Reply all
Reply to author
Forward
0 new messages