Create TNS files from Lua and XML

Luna 2.1

Luna is a portable command-line converter of Lua and Python scripts to TNS TI-Nspire documents.
Lua scripts require OS 3.0.2 or later, and Python scripts require CX II OS 5.2 or later.

It can also be used to convert any TI-Nspire problems in XML format to TNS documents.

Usage

  • Lua program conversion: luna INFILE.lua OUTFILE.tns
  • Problem conversion: luna Problem1.xml OUTFILE.tns
  • Multiple files: luna Document.xml Problem1.xml [Problem2.xml...] OUTFILE.tns
  • Python conversion: luna InFile1.py [InFile2.py...] OUTFILE.tns

If the input is -, it reads the file from the standard input.
Make sure to encode your Lua or Problem file in UTF-8 if it contains special characters. You can also pack arbitrary files like images into the TNS.
For Python, the first script will be the one that shows when the TNS document is opened.

Bugs, feedback…

Please use the GitHub issue tracker.

License

Luna is licensed under the Mozilla Public License v1.1.
Luna is based on a derived version of MiniZip. See minizip-1.1/MiniZip64_info.txt for more information.
Luna includes cryptographic software written by Eric Young ([email protected]), see the DES.* files for more information.

Building it yourself

You need the zlib (zlib1g-dev/zlib-devel) development library. On macOS, you can use brew: brew install zlib
Then you can just run make.

History

2022-09-29: v2.1

  • NEW: Support for CDATA
  • FIX: luna now defaults to an older file header version unless one of the input files is a .bmp
  • FIX: Fix invalid generation of XML documents with more than 256 tags
  • FIX: Fix crash when using with XML documents with many tags

2016-12-28: v2.0

  • NEW: No OpenSSL library dependency anymore, just use the relevant DES code.
  • FIX: Fix crash when parsing deeply nested XML documents

2016-12-27: v1.0.1

  • NEW: Show Luna version in usage message
  • FIX: Some minor warnings

2016-12-27: v1.0

  • NEW: Install target in Makefile
  • NEW: Add support for .BMP resources
  • NEW: License under Mozilla Public License v1.1
  • FIX: Fix build with OpenSSL 1.1 using newer DES API

2012-06-26: v0.3a

  • FIX: build options for Mac/Linux
  • FIX: skip UTF-8 BOM if any
  • FIX: compatibility with some Unicode characters such as Chinese ones

2012-06-24: v0.3

2011-11-10: v0.2b

  • FIX: buffer overflow

2011-09-27: v0.2a

  • FIX: characters at the end of a Lua script might no be correctly XML-escaped
    (thanks Goplat)
  • FIX: wrong buffer size handling might cause ‘<’ and ‘&’ characters in Lua
    scripts to produce bad TNS files (thanks Goplat)
  • FIX: TNS documents were abnormally big because of trailing garbage data being
    encrypted (thanks Levak)

2011-09-19: v0.2

  • NEW: supports arbitrary TI-Nspire problem conversion, useful to build
    third-party document generators

2011-08-08: v0.1b

  • NEW: lua file can be provided from stdin
  • FIX: crash if input file doesn’t exist

2011-08-06: v0.1a

  • Can be built on Linux

2011-08-05: v0.1

  • First release