Learning Lua


This project could be called Lua Tetris or Chaste Tris Lua version. I translated about 20 kb of C code into Lua syntax which was hard work because I started knowing next to nothing about Lua.

However, since Lua, just like C, does not have graphics and keyboard management built into the language itself. I decided to give the Love2D framework a try. This is my very first project using it and I succeeded.

Lua does not use curly braces {} for functions or conditional statements. Therefore I had to modify everything in the program except the variable names remained the same. Lua tables replaced C structures which made it awkward since tables are copied by reference rather than value. However if I had more knowledge of Lua I probably would have figured out a solution for this.

Also, in Lua, the not equals operator is ~= instead of != like in C.

In spite of my newness to Lua, I did get the project working and it is fully playable. The advantage of downloading this one conpared to the C version is that if you’re familiar with Lua you can learn from my code.

I will continue learning Lua and perhaps make small updates to this project if I find more efficient solutions.

Files

Lua_Tetris.love 74 kB
Feb 13, 2023

Get Lua Tetris

Buy Now$2.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.