General information

Subject type: Mandatory

Coordinator: Juan José Pons López

Trimester: First term

Credits: 6

Teaching staff: 

Marco Antonio Rodríguez Fernández
Alejandro Jiménez Encinas 

Teaching languages

  • Spanish
  • Catalan

Les classes de l'assignatura es faran principalment en català, tot i que la bibliografia i el material de suport podran ser en altres llengües (castellà i anglès)


Specific skills
  • E7. Develop video games in interpreted languages ​​to prototype gameplay, user experience and balance.

General competencies
  • G3. Gather and interpret relevant data (usually within their area of ​​study) to make judgments that include reflection on relevant social, scientific, or ethical issues.

  • G5. Develop the learning skills needed to undertake further studies with a high degree of autonomy.

Transversal competences
  • T2. Work as a member of an interdisciplinary team either as an additional member or performing management tasks in order to contribute to developing projects with pragmatism and a sense of responsibility, making commitments and taking into account available resources.


Interpreted languages ​​are widely used as a resource in the programming of applications and video games, for their great flexibility, versatility, simplicity and efficiency. At the same time, integrated into more complex compiled applications, they provide valuable tools such as real-time interactive development, execution, and debugging, saving resources and compile time in the main application (or engine).

In this course we will introduce one of the most widely used interpreted languages ​​currently in the video game industry: Lua (

As this is a second-year subject (where three previous programming subjects have already been taken), it is assumed that the student has an adequate knowledge of the fundamentals of programming, object-oriented programming and programming applied to video games. In this sense, it should be noted that a brief introduction to the language and its particular characteristics will be made, to quickly focus on the applications of programming through scripting in game environments. It is highly recommended that the student has successfully completed the contents of the previous programming subjects, in order to be able to follow the subject normally.


1. Introduction to interpreted languages
1.1. Classification of programming languages
1.2. Compiled languages ​​vs interpreted languages
1.3. Basic concepts of interpreted languages
2. Programming with Lua
2.1. Basic features
2.2. Common uses
2.3. Interpreter / IDE
2.4. Modes of development
2.5. Chunks and blocks
2.6. Grammar rules
2.7. Unwritten rules and programming style
2.8. Local variables and global variables
2.9. Regular operators (arithmetic, relational and logical)
2.10. Specific operators (concatenation and size)
2.11. Table builders
2.12. Multiple return
2.13. Higher order functions
2.14. Variable arguments
2.15. Metatables and metamethods
2.16. Object-oriented programming
3. Graphic programming with the Love engine
3.1. Events
3.2. Graphics
3.3. Finite state machines (FSM)
4. Application of scripting to game environments: Modding
4.1. Data files (csv, xml, json).
4.2. Game configuration files.
4.3. Integration in applications and game engines
4.4. Structural analysis of a commercial game.
4.5. Use of Lua and Xml, for the generation of mods.
5. Application of scripting to gaming environments: Lua embedding in the Unity3d engine
5.1. Integration of a Lua performer as an asset.
5.2. Runtime load.
5.3. Interaction with Unity3d objects

Evaluation system

The grade of each student will be calculated following the following percentages:


A1. Exercise in class: Tables with Lua 1.8%

A2. Class exercise: Images with Love 1.8%

A3. Class exercise: Sprites with Love 1.8%

A4. Exercises in class: Luathon 2.8%

A5. Exercise at home: Modding with Lua 1. 8%

A7. Laboratory practice: Introductory session with Lua's interpreter 4%

A8. Laboratory practice: Guided programming of a game with the Love library 6%

A9. Laboratory practice: Free programming of a structured game with Love 12%

A10. Laboratory practice: Making scripts on Lua for a commercial game 12%

A11. Laboratory practice: Integration of scripting in Lua with a game made on a graphics engine 6%

A12. Final Exam 50% 


Final grade = A1 0,018 + A2 0,018 + A3 0,018 + A4 0,028 + A5 0,018 + A7 0,04 + A8 0,06 + A9 0,12 + A10 0,12 + A11 0,06 + A12 0,5



  • It is necessary to obtain a mark higher than 5 in the final exam to be able to pass the subject.
  • An activity not delivered or delivered late and without justification counts as a 0.
  • It is the responsibility of the student to prevent plagiarism in all its forms. In the case of detecting plagiarism, regardless of its scope, in any activity it will correspond to having a grade of 0. In addition, the teacher will inform the head of studies of the situation so that applicable measures can be taken in the matter of sanctioning regime.
  • Attendance at laboratory practices is mandatory.
  • The retake exam only recovers the theory note.



Lerusalimschy Roberto. (2006). Programming in lua. Roberto Ierusalimschy.

Lerusalimschy Roberto, DeFigueiredo Luis Henrique & Celes Waldemar (2006). Lua 5.1 reference manual.

Kasuba Mario (2015). Lua game development cookbook. Packt Publishing


Derek Paxton (2016). Mooder's guide to Civilization V. Retrieved from


Young David (2014). Learning game AI programming with Lua. Packt Publishing Ltd.