Application Guide
Writing Lua Scripts
The Script Editor allows you to create and deliver dynamically linked simulations,
powerful and flexible utilities, and other educational content for exploring math and
science concepts. When you open a document containing a script, the script runs
automatically as programmed. To see the running script application, the page
containing the script application must be active.
The Script Editor is directed toward teachers and other authors who are comfortable
working in a Lua scripting environment. Lua is a powerful, fast, lightweight scripting
language that is fully supported in TI-Nspire™ and PublishView™ documents.
Documents containing script applications can be opened on TI-Nspire™ handhelds. The
script application runs on a handheld, but you cannot view or edit the script.
Note these resources for using the Script Editor and creating scripts:
• Press F1 to access the TI-Nspire™ help, which includes the Script Editor help.
• Press F2 for additional TI-Nspire™ resources such as scripting samples and a link to
the TI-Nspire™ Scripting API library. (This information is also available at
education.ti.com/nspire/scripting.)
• Go to lua.org for more information about Lua.
Overview of the Script Editor
With the Script Editor, you can insert, edit, save, run, and debug script applications
inTI-Nspire™ (.tns files) and Publishview™ (.tnsp files) documents.
• Script applications function within documents, problems, and pages the same way
that other TI-Nspire™ applications do.
• When you create a new document or open an existing document, you can insert or
edit a script application within a page or within a work area of a split page.
• In a split page layout, you can add a script application to each work area of a page.
A page can be split into a maximum of four quadrants.
• Images can be added to script applications. See the Inserting Images section.
• All work done in the Script Editor is lost if you close the TI-Nspire™ or
PublishView™ document without saving it.
Exploring the Script Editor Interface
The Script Editor window opens when you insert a new script application or edit an
existing script application in a TI-Nspire™ or PublishView™ document.
Select options for creating new scripts or editing scripts from the Insert menu in the
Documents Workspace when a document is open.
Note: Although not labeled, the Documents Workspace is the default workspace in the
TI-Nspire™ CX Student Software and TI-Nspire™ CX CAS Student Software.
The following figure shows the Script Editor with an existing script.
Writing Lua Scripts 513