Lua: a multipurpose tool for creating teaching materials without an endless learning curve

Lua keeps growing. Forms now do the maths themselves, a single form can produce several documents, and templates can be taken from one computer to another. To see it in action, here are two files to download: a complete construction budget and a company template. I have also included an instruction for building a Year 2 Bachillerato Maths practice sheet.

Open Lua online → https://piztu.org/lua

Lua online: the construction budget form on the left, the PDF generated with the Néboda Estudio template on the right

One tool, many needs

Lua was not built to do just one thing. It aims to meet many of the needs teachers have when preparing teaching materials: exams and practice sheets, individualised worksheets, answer keys, data-driven reports, department minutes and schedules… and, as this post shows, even a construction budget for a vocational building course.

The key is that everything works the same way. You learn once how to handle projects, forms, reports and templates, and from then on there is no limit to what you can create. You do not have to learn a new tool for each kind of material, or keep studying the program forever.

That is what sets it apart from platforms such as Moodle. They are very complete, but they have an extremely long learning curve: there is always another module, another setting or another menu to discover. Most teachers cannot, and do not want to, spend that much time editing and publishing materials. They want the material ready so they can get back to what matters: the classroom.

Learn a little, do a lot. That idea runs through the whole Piztu project, and Lua is its clearest example: a tool you master in a short time and that then serves for almost everything. And if you would rather not start from scratch, Lua’s assistant can build the form for you from a description, as you will see in the Maths example.

One Lua, two ways to use it

  • Installable (Debian, Windows and macOS). This is the option for everyday use. It works offline, your projects stay on your computer, and it makes use of programs you already have installed, such as LaTeX or Maxima. If you do not have it yet, here is how to install it.
  • Online, at piztu.org/lua. Nothing to install. Lua, the engine that builds the PDFs and Maxima all run inside the browser. The first load takes a while because it downloads those engines; after that it is quicker.

Both versions share the same .lua file format. A project made in one opens without problems in the other.

What’s new

Forms that calculate on their own

Any field or column can have a formula, for example quantity * price. That value is no longer typed in: Lua works it out instantly. You can also fix the number of decimal places (two for money) and hide columns that count in the totals but do not appear in the document.

Sub-tables, references and grouping

A table can contain another table. That is how you build, for example, a budget with chapters → items → measurements. With references you pick a row from another table, such as a material from the price list, and its price comes along with it. The document can also group rows under a heading with a total at the foot of each group, or expand all the items into a single table.

Several documents from the same data

A form no longer produces just one document. You can add reports: a summary and a detailed version, one with prices and one without, or an exam and its answer key. Whoever uses the form sees each report as a tab or a button, and clicking it generates that document.

Try it before sharing it

The form designer has a Try it tab that shows the form exactly as its users will see it. Any test data you enter is calculated straight away, and it is not saved.

Update without losing data

If you bring in a new version of a form you already use, Lua asks whether you want to update it and keep your data. The previous version is saved, and you can undo the change.

Templates you can edit outside Lua

The Export to edit button saves the template as a folder of text files. You can then improve it with an editor or with an AI, and bring it back in with Import folder.

Modules

Other people can build tools for Lua, such as form builders or converters, using its API. Each module runs in isolation and only does what you allow it to: view forms, write data, generate documents…

Example 1: construction budgets (roque.lua)

This project brings almost all the new features together in a real case: a construction budget in the style of building estimating software. It includes:

  • A basic price list with labour, materials and machinery.
  • Chapters with items. Each item has its own measurements (units × length × width × height) and its cost breakdown, using resources picked from the price list.
  • A summary with overheads, industrial profit and VAT.

It also comes with seven reports built from the same data, each with its own button: Medicións, Prezos unitarios, Descompostos, Presuposto, Presuposto sen valorar, Resumo e cálculos and Orzamento completo (the sample project is in Galician).

Everything is calculated automatically: change a price in the list and the items, chapters and total all update. The file includes sample data so the PDF comes out right first time.

Construction budget form in Lua with the seven reports as buttons
The «Orzamento de obra» form: one button per report at the top; below, the project details and the chapters with their items.
Resumo e cálculos report: the amounts calculated automatically on the left, the PDF with the summary by chapter and the budget total on the right
The «Resumo e cálculos» button: on the left, the amounts Lua calculates (nothing is typed in); on the right, the PDF with the summary by chapter, the taxable base, VAT and the total.

Download roque.lua project «Roque · Orzamentos de obra»

Example 2: a company template (estilo.lua)

The «Orzamento — Néboda Estudio» template is a company design with an editorial cover page. It has a light header, a footer with tax details and page numbers, and a double signature block (company and client). It fits the construction budget, but it works for any document: change the company name, tax ID and website and it is yours.

First page of the budget with the Néboda Estudio template
The budget with the Néboda template: a light header with the company name and document title, and the items grouped by chapter.

Download estilo.lua «Néboda Estudio» template

How to bring them into Lua

The project and the template are brought in the same way:

  1. Download roque.lua and estilo.lua.
  2. In Lua, click the Transfer button and go to the Bring into Lúa tab.
  3. Click Choose file… and find the file. Lua shows what it contains; click Bring in. Repeat with the other file.
  4. Open the Roque · Orzamentos de obra project, choose the Néboda Estudio template in the Template selector above the preview, and click Generate.
Transfer dialog, Bring into Lúa tab, with the roque.lua file selected
Before bringing the file in, Lua shows what it contains and reminds you that nothing you already have will be touched.

Example 3: a Year 2 Bachillerato Maths practice sheet

This last example is not a file but an instruction for Lua’s assistant. Copy the text, paste it into the assistant, and Lua creates the project, the form and the two buttons. It makes use of reports as buttons, formulas, and Maxima to calculate the results:

Create a project called "Maths – Year 2 Bachillerato" with a form
for preparing exercise practice sheets.

GENERAL DETAILS
- Practice sheet title, topic block (Analysis, Algebra, Geometry,
  Probability and Statistics), date and instructions for students.

EXERCISE TABLE (one row per exercise)
- Number, block and score (with 2 decimal places).
- Statement (with formulas in LaTeX).
- Worked solution (the main steps).
- Final answer (short and highlighted).
- Graph: yes/no. If yes: the function or functions to plot,
  x-axis interval and points to highlight (axis intercepts, extrema,
  inflection points, asymptotes). Draw it with pgfplots, with labelled
  axes and a light grid.
- Use Maxima to calculate and check the results (derivatives,
  integrals, limits, determinants, systems…).
- At the foot of the table, the total score calculated as the sum of the scores.

TWO REPORTS, SHOWN AS BUTTONS
1. "Statements only": the practice sheet to hand out. It includes the
   statements, any graphs that are part of a statement, and space to answer.
2. "Statements and answers": each statement with its final answer
   in a box and, where relevant, the graph of the solution.

Fill in the form with a sample practice sheet of 6 varied exercises:
- study and sketch of a rational function,
- area between two curves (with graph),
- a limit using L'Hôpital's rule,
- a 3×3 system with a parameter (discussed with the Rouché–Capelli theorem),
- relative position of two lines in space,
- a normal distribution problem (with a graph of the bell curve).
Then generate both documents to check they come out correctly.

Tip: if you want a third button with the full answer key (the step-by-step solution), ask the assistant in a second message. It is just another report on the same data.

Year 2 Bachillerato Maths practice sheet created with Lua
Year 2 Bachillerato Maths practice sheet with statements and answers in Lua

Downloads

  • roque.lua: the «Roque · Orzamentos de obra» project with sample data.
  • estilo.lua: the «Orzamento — Néboda Estudio» template.
  • mates.lua: the Maths project from the previous post, in case you want to compare.

If you try any of these examples, or build your own practice sheet with the Maths instruction, let me know how it went. Your feedback helps decide where Lua goes next.

Scroll to Top