Learn to Code via Tutorials on Repl.it!

← Back to all posts
Lua - Probably One Of the ONLY Tutorials for Lua Out there..

So, I've haven't really seen much Lua tutorials out there, so I thought I'd try making my own (based on what I know!)..So, here ya go! The

(really dumb) LUA TUTORIAL!!!

Yeah, AMAZING isn't it? Okay, so let's go from the very start. Print functions. You know them by now right?

Simple as pie, isn't it? Well that's the print command, a built-in function that prints a String (or str if you're fancy) into the console!

So why Lua?

Well, I get that there may be much better programming languages out there, but believe me when I say that lua has helped me understand python, etc so much better! And again, I'll teach you Lua and why it's good for me (and maybe for you ;])

But what if we could do it another way? Perhaps a..

Yes, I'm not joking you can use functions on this bad boy too, and in my opinion, easier to learn than python (can differ from your first language). So..

What's a function?

A function is an essential to most scripts/code made on replit, you probably saw python code with like idk, let's say

Yeah, that makes no sense to me at the moment, but I can tell you now, lua functions are as easy as 1-2-3! Let's make a function right now..But what?

Coming up with ideas

It's not a surprise that you need creativity to think of something good, BUT! The best coders were never the brightest at the start. They've most likely taken code from the internet and observed it, tinkered with it, sees what goes wrong if you change something specific in the code. It's all a part of the learning process!

So, finally, let's get started with the functions!

Now, let me explain the END part. It's to end a function, because you don't want the code thinking the whole of your script is the function, now do ya? :]

Basically, we call the function's name, which makes it run. Pretty simple..Isn't it? Well, now that you should know functions, let's do a for loop!

While/for loops!

Okay, let's just do a simple for script:

Now, I know this looks complicated, but let's think for a moment. For every i (which is 1), until the limit (which is five) do (code here). I'm adding it until it hits the limit, then it'll stop. This is the expected output:

Not much to add here, just adding! We'll get back to this another time...And, that's part 1 for this tutorial! I know it's short, but you got to keep in mind I'm also still learning, this isn't all that I know by the way, but I want to do it step by step so nobody is confused.

What's next?

Well, you can always try the examples when you first start a replit with lua, it might not be as helpful, but like I said the best coders learn from pre-made scripts. Also, if you ever find code hard to make, and you want to maybe find help on some website like for instance "stackoverflow", then please keep in mind of this quote!:

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

― Martin Fowler

Now, with that in mind, I hope you enjoyed this tutorial, first post I've ever made (don't get mad at me if I didn't markdown correctly, I'm new to this ;w;)

Have a nice day!..

(Part 2: https://replit.com/talk/learn/Lua-Part-2-Tables/146896)


<3 thanks


@lajbel Your welcome! Please be sure to tell me what you'd like to know next c:


@Opalmime classes and methods!


@lajbel Classes..? hm..I'll have to look into that! Also, be specific on what type of methods.


@lajbel Also! I'm making a tutorial currently on tables for Lua! So make sure to look out for it.


@lajbel Just released my new tutorial! Check it out ;) https://replit.com/talk/learn/Lua-Part-2-Tables/146896


Showing this to my friend so they can start learning lua!


Thanks! @TannerPerego


print ('thats realy until ',;-) ')


This is allright! Its the easiest language I have seen.!
find a word


@TitusGaelic Thank you! I've also made a new tutorial, I'll quickly edit the tutorial so the link to the second one is at the bottom :3


I wanna add Lua modding support to a C# .NET game I am making, can I do that without recreating the whole Lua interpreter?


@TheTesterz That's honestly a good question..I'd imagine no, but I can't be for certain, I mean I'm just a 14 year old making dumb tutorials .3.


Lua is easier than English when you natively speak it officially, LOL.
Its the easiest language I have seen.


Maybe suggest what you'd like to learn about lua? 😳