{}const=>[]async()letfn</>var
Development

Your first Lua script in 10 minutes

💡 A simple guide for beginners to try programming without fear and installing an IDE

К

Kodik

Author

2 min read

🧩 What is Lua and why do you need it?

Lua — a lightweight and fast programming language, ideal for beginners. It is used:

  • 🎮 In game development (Roblox, Love2D)

  • ⚙️ Integrates into applications (for example, in C++)

  • 🤖 In automation, scripts, microcontrollers

The good news is that Lua is very friendly to beginners.

🔥 100,000+ students already with us

Tired of reading theory?
Time to code!

Kodik — an app where you learn to code through practice. AI mentor, interactive lessons, real projects.

🤖 AI 24/7
🎓 Certificates
💰 Free
🚀 Start learning
Joined today

⚙️ Preparation: where to write the code?

For the first script, you don't need to install anything — just open Replit (Lua) and start writing!

If you want it locally: download Lua for Windows or install via brew install lua (on macOS).

✍️ Writing our first script

print("Hi Lua!")

📌 print — a command that outputs text to the console.
🧠 Everything enclosed in quotation marks is considered line.

👉 Run the code — you will see:

Привет, Lua!

🧮 A little bit of math

print(2 + 2)
print(5 * 3)
print(10 / 2)

👉 Lua handles arithmetic easily and clearly.

👤 Working with variables

name = "Code"
age = 3

print("Hi, my name is " .. name)
print("To me " .. age .. " year")

.. is gluing rows in Lua.

🧠 Logic: if this, then that

score = 85

if score >= 80 then
    print("Excellent! 🎉")
else
    print("You need to try again!")
end

📌 Conditional statements always end with end.

🔁 And now — the cycle!

for i = 1, 5 do
    print("We calculate: " .. i)
end

🔄 Loop from 1 to 5. i — counter.

🎁 Mini-project: calculator

a = 10
b = 5
operation = "+"

if operation == "+" then
    print(a + b)
elseif operation == "-" then
    print(a - b)
elseif operation == "*" then
    print(a * b)
elseif operation == "/" then
    print(a / b)
else
    print("Unknown operation")
end

You can change the values of a, b, and operation to get different results.

🌈 What's next?

You already know how to:

  • display text;

  • work with variables;

  • write conditions and loops;

  • create mini-programs!

🔥 This is the basis of any code. Want more? In the next article, we'll talk about tables and functions.

🐾 What does Kodik do?

Code - is the hero of our application "Kodik: Programming Training". It helps beginners learn programming in a fun, step-by-step, and stress-free way.

Our app already has a Lua course with exercises, tips and mini-games! 🎮

🎯Stop procrastinating

Liked the article?
Time to practice!

In Kodik, you don't just read — you write code immediately. Theory + practice = real skills.

Instant practice
🧠AI explains code
🏆Certificate

No registration • No card