General information

Subject type: Mandatory

Coordinator: Adso Fernández Baena

Trimester: First term

Credits: 6

Teaching staff: 

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

Teaching languages

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 Applied Programming in video games. Enrollment in this subject is not recommended if you have failed previous programming subjects. 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.


Learning outcomes

At the end of the course students must be able to:

E6.6. Develop video games in 2D and 3D (or parts of it) in high-level languages ​​on platforms and engines intended for this purpose.

E7.1. Classify and describe current interpreted languages ​​and their characteristics.

E7.2. Programming with interpreted languages ​​to develop gameplay, interaction and balancing prototypes.

Working methodology

All the theoretical concepts of the subject will be exposed in theory classes in a lecture, case study or question-based learning format. In these classes, at the discretion of the teaching staff, exercises and problems of a more practical nature will also be solved. These short activities will serve the student as an instrument for self-evaluation of his achievement of the contents of the subject and will be evaluated as individual work. Laboratory practices will be carried out in small groups and the practical application of theoretical concepts will be worked on. In the sessions that are scheduled for this purpose, the appropriate tools will be given to solve the scheduled activities and that it is expected that these will extend from a temporal point of view beyond the laboratory hours and that, consequently, students must complete them during the independent learning time.


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

Learning activities

With the aim of collecting evidence of the achievement of the expected learning outcomes, the following activities of an evaluative nature will be carried out (related to all the common competences):


A1. Exercise in class: Tables with Lua (Evidence of learning outcome E6.6)

A2. Exercise in class: Images with Lua (Evidence of learning outcome E6.6)

A3. Exercise in class: Sprites with Lua (Evidence of learning outcome E6.6)

A4. Exercises in class: Luathon (Evidence of learning outcome E6.6)

A5. Exercise at home: Modding with Lua (Evidence of learning outcome E7.2)

A6. Exercise at home: Scripting with Lua (Evidence of learning outcome E7.2)

A7. Laboratory practice: Introductory session with Lua's interpreter (Evidence of learning outcome E6.6)

A8. Laboratory practice: Guided programming of a game with the Love library (Evidence of learning outcome E6.6)

A9. Laboratory practice: Free programming of a structured game with Love (Evidence of learning outcome E6.6)

A10. Laboratory practice: Making scripts on Lua for a commercial game (Evidence of learning outcome E7.2)

A11. Laboratory practice: Integration of scripting in Lua with a game performed on a graphics engine (Evidence of learning outcomes E7.2 and E6.6)

A12. Final Exam (Evidence of all learning outcomes) 


General criteria of the activities:

  • The teacher will present a statement for each activity and the evaluation and / or rubric criteria.
  • The teacher will inform of the dates and format of the delivery of the activity.
  • Any undelivered activity will be assessed with 0 points. No late delivery will be accepted.

Evaluation system

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


A1. Exercise in class: Tables with Lua 1.5%

A2. Class exercise: Images with Love 1.5%

A3. Class exercise: Sprites with Love 1.5%

A4. Exercises in class: Luathon 2.5%

A5. Exercise at home: Modding with Lua 1.5%

A6. Exercise at home: Scripting with Lua 1.5%

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,015 + A2 0,015 + A3 0,015 + A4 0,015 + A5 0,025 + A6 0,015 + A7 0,04 + A8 0,06 + A9 0,12 + A10 0,06 + A11 0,12 + 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 (court summons or medical matter) 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, R. (2006). Programming in lua. Roberto Ierusalimschy.

Lerusalimschy, R., De Figueiredo, LH, & Celes, W. (2006). Lua 5.1 reference manual.

Kasuba, M. (2015). Lua game development cookbook. Packt Publishing



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


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