A Library in Lua

June 29, 2024

I don't know, maybe a window to another part of the software development world...

programming-language lua fun
1

My third post, like the previous two, is related to "adventure" in different programming languages! I don't know how useful this kind of posts can be, but most likely it has its own fans (even a few) and it's interesting for me too...

Lua Programming Language

Since this post is not long in terms of content other than code, I will tell you a little about Lua!

Wikipedia says:

Lua (/ˈluːə/ LOO-ə; from Portuguese: lua [ˈlu(w)ɐ] meaning moon) is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications. Lua is cross-platform, since the interpreter of compiled bytecode is written in ANSI C, and Lua has a relatively simple C API to embed it into applications.

And:

Lua originated in 1993 as a language for extending software applications to meet the increasing demand for customization at the time. It provided the basic facilities of most procedural programming languages, but more complicated or domain-specific features were not included; rather, it included mechanisms for extending the language, allowing programmers to implement such features. As Lua was intended to be a general embeddable extension language, the designers of Lua focused on improving its speed, portability, extensibility and ease-of-use in development.

Except for the last program that you will see in the next part of this article, almost the rest of the programs are also written in Teal (Lua, but its statically typed version)... I really liked its syntax, the facilities it offers and its good execution speed; but due to the inability to understand the logic of the code, and because it only relies on specified types, it gives ridiculous errors sometimes!

What Did I Make With It?

Lua Itself

Definitely the first one was Fizzbuzz!

To learn how to take user input, mathematical operators, and function declarations, writing a simple calculator program isn't a bad place to start...

A very simple linear search algorithm on the languages ​​I knew (even just their names)...

Number guessing game with the ability to manipulate the difficulty level:

And something that can be very useful, especially for those who have experience working with the functional programming paradigm:

In Teal

I have decided to put the codes here without explanation so that you can understand the syntax; but from the names of the functions, you can easily guess what they are about...

Last Words

I don't know yet what I want to do with Lua in the future, but maybe later I want to make a game with it for smartphones that...

Useful links:


Comments on this post

Artin Mohammadi sheikhartin@gmail.com ADMIN June 29, 2024, 6:10 p.m.
The title of this article was chosen "A Library in Lua" because this topic made me think that it might not be bad to write something more detailed [than tweets] about Lua...

Leave a comment

Comments can only be deleted by the author of the post...