How to learn Lua as an experienced programmer?

I’ve been building on Roblox for a little while and I’ve monkeyed around with various scripts before, but I want to really get into Lua and Luau and learn to program for my own games. I’ve got experience using Python and Java, so I’m very familiar with the fundamentals of programming, I just want to learn the specifics of Lua and how it works.

I’m particularly keen to learn best practices for Roblox development and how to use the various APIs and services that devs have access to these days, but I’m also looking to figure out where to start - it’s a little overwhelming trying to figure out a new language.

3 Likes

We’ve all been there, you can start learning on developer.roblox.com (that’s the go-to site for both the documentation and some tutorials).

You could also check out some scripting tutorials, though I personally never watched those, I know some people do need for someone to explain stuff to them by voice for them to understand.

Also, there’s plenty of tutorials here, on the devforum!

That’s everything that I can say from the top of my head, good luck!

2 Likes

Personally, watching YouTube tutorials helped me a lot.

TheDevKing has some pretty good tutorials, his videos will teach you the basics of lua and the roblox API.

Oceanskiy is also a good channel, although his tutorials are usually more advanced so I’d recommend learning lua first.

The roblox wiki also has some tutorials, and it has all the documentation of the different services, so you can also learn scripting from there, although I usually use the wiki as a reference

2 Likes

Honestly even as a sorta “experienced” programmer with 1 year of Java AP computer science in school I had the same problem:

Consequently, like all the posts before on this topic, I recommend just starting back from the basics with a video tutorial. Personally I recommend PeasFactory as I learned from him.

However, now that you are experienced you can skip most of the explanation on similar programming terms like variables to instead just focus on the syntax instead and the following things that I noticed when I first started learning.

Here are the things I noticed that are pretty important to Lua coming from Java and that you should focus on:

  • The most important Object referencing:
    Learn how to reference a specific object in the workspace and notice the hierarchy similar to folders in a computer. Don’t be like me who gave up scripting initially because I didn’t know what script.Parent did and how the placement of the script in the game mattered. Example:
local part = game.Workspace.Part
-- or shorten it
local part = workspace.Part
--Or in String format if the instance has a space in it's name
local part = workspace["Base Part"]
  • Advanced object referencing utilize the instance class functions like WaitForChild, FindFirstChild to reference the object you need

  • Generally, Objects even though I learnt them in Java on what they do can be pretty tough as Roblox has it’s own special objects like Parts with functions, properties, and events. One way to explore though is through the Object Browser in studio or through the api-reference website.

  • Good practices like using local variables to reduce memory usage

  • The Roblox event system I found was pretty unique

  • Script vs Local Script. Scripts are run on server and local scripts run on the client. Stuff like humanoid health cannot be changed locally to prevent exploiters.

Overall do the usual learn and get some practice. Good Luck!

1 Like

Since you already have familiarity with some languages, Lua will be a piece of cake for you.

If you want to learn Lua, just take the same steps that you did to learn Python & Java. Start learning about the API on the site, and experiment with what you’ve learned. You can go on YouTube and find tutorials there, but personally, I think that to achieve the fastest and most accurate results, you should couple learning on Youtube and other sources with actually testing out what you learn in Roblox Studio. This way, you’ll be able to get a good hands-on experience and learn about the various errors that Lua gives you.

Good luck!

1 Like

Before I learnt lua, I already knew c#, C++, and python. The thing about lua is that you’re going to have to forget a lot of the principles you probably learnt about object oriented design. Things like the S.O.L.I.D principles and stuff. This is mostly because you can’t define your own types in lua. But other than that, it will be extremely easy for you. Also, the absolutely terrible intellisense may or may not drive you insane. It drove me insane.

2 Likes

Hmm, Have you tried coding roblox on an external IDE like Microsoft vscode and working with Rojo? They got special stuff like tab nine and special linters which may help.

And also can’t you use metatables to replicate OOP-object organization in Lua which allows you to apply some principles of object-oriented design?

2 Likes

I fall under the same category, I am learning but Lua but am good in Java. Honestly, they are similar, knowing Python is a big boost because those 2 are quite similar. As people said use the Roblox dev website. That’s what I am using.

1 Like

Thanks for the recommendation, I’ll use rojo.

Also, I really don’t think its worth it. Some of the stuff you need you just can’t do with lua unforunately.

2 Likes

developer.roblox.com is the best for beginners to get a hold of roblox, once you read the most important ones, datastore, modules, metatables, humanoid, usi, etc, then you move on to study Programming in Lua (first edition). Once you finish this you practically mastered 80% of useful lua. I take around 40 minutes now studying the lua website, and trust me it further solidify me as a lua programmer.

You guys talking about developer.roblox.com and lua docs and alvinblox and youtube … etc

But why not here or scripting helpers? Scripting helpers is a less advanced version of this site which forces light theme on your eyes but you can still gain a ton of knowledge from both sites.