What resources can I use to learn about the nuances, terminology, application and such of Lua?

lua
programming

#1

I have not touched Roblox Studio in around 3 months now and I feel like I’ve lost my touch. I believe primarily that my shortcomings lie in the application part of programming rather than the doing, which is why I come to learn more about Lua.

I have a generally stable understanding of the entire Roblox Lua API, but that’s as far as my coding knowledge goes. I know nothing about Lua as it applies out of Roblox, nor do I know any technical terminology or anything. I don’t know the difference between good and bad practices, good and bad optimisations, edge cases (I just fling that term around but haven’t a clue what I’m talking about), nothing. I can’t even use a debugger properly. I only really know how to code things, but nothing else is known to me. Sometimes it becomes frustrating to follow some conversations or see that I’ve said something “wrong”.

I would like to know if there are any good resources to learn about the depths of Lua and of Roblox Studio. It may not be possible to learn everything, but I would at least like to further my knowledge so I can be more resourceful to both myself and others in and out of discussion.


#2

Hang around people who you believe are a lot smarter than you in the fields of computer science and Google the words they say. If you can, take a CS class.


#3

Stuff like this can’t simply be found in one big document on the internet. You learn this kind of stuff as you expand your lua knowledge.

Though you can always hang around with other people that know roblox lua very well, and ask them to tell you if anything in your code could’ve been done better.

It’s impossible to list all good practices, optimizations and stuff like that in one list, because there are simply too many of them to remember from the top of your head, while other ones are defined by common sense from what you already know.


#4

I say this mostly because I don’t know where to go from where I am. I know most of what there is to know about Roblox Lua - it’s just putting that knowledge backward to learn Lua without it sandboxed and if there’s even anything left to learn. I get what you mean though with the rest.


#5

There is an online reference manual for Lua 5.1.

Roblox uses a modified version of Lua 5.1.4, so most of the manual should be pretty relevant.

In regards to optimization, a well known saying is don’t do it and if you’re an expert, don’t do it yet.


#6


#7

A combination of experience and the manual will take you far. When it comes to the more practical part of things, I suggest the lua-users wiki because it has quite a few examples of common ideas (even though it’s not very good for learning the language). You can also try the developer hub, as it provides some very nice and simple explanations for some of the more complicated topics in Lua.

Otherwise, just try things! When it comes to raw Lua, most of my knowledge of it comes from third party projects as on Roblox there’s some restrictions that Roblox put in place for security reasons, but good practices and best methods in Lua tend to carry over nicely. I would recommend you spend some time learning the intricacies of Lua’s string patterns, as they’re often confusing either because of inexperience or experience with regex (which string patterns are not).

You should also make something. Whether it be a plugin, a functional GUI, command script, or even a discord bot, having a project that you’re actively working on forces you to learn new things to adapt to problems that come up, and it provides a tangible way to test your skills. The only way you improve is by doing, after all.

As an aside, Rbx.Lua is different from normal Lua in a variety of ways. As @pheonixmario said, it uses a modified version of 5.1.4, which means that for the most part everything you find on 5.1 should be accurate. It also has the utf8 library imported from Lua 5.3, and has its own changes to the various libraries and vanilla functions. This is why the developer hub is a good resource, because it documents these changes.

You may also want to get an interpreter for Lua built and running on your PC. I end up using the one I have a lot because Roblox Studio isn’t the best for messing around with Lua. If you want to, there’s a nice tutorial here that’s relatively easy to follow. There’s no reason you can’t use Roblox for all of this but it’s more convenient in my experience to have an interpreter seperate from Roblox itself.


#8

The PiL (Programming in Lua) is probably the safest bet.


#9

Can recommend this method. This is how I learned how to code in JavaScript and C#


#10

Reading Programming in Lua, at least chapters 1-6 if you’re using the 1st edition, is an absolute must if you actually want to understand Lua. It is virtually impossible to become truly competent at Lua without reading PiL. The only other resource that will deliver equivalent mastery is the reference manual, which you don’t need to read. The 1st Edition is for Lua 5.0, which is close enough to use, but the 2nd Edition is for 5.1 and has exercises.

I highly recommend it. Read the whole book if you’re so inclined, it will make you a better programmer.

Learning general compter science knowledge is highly recommended, there are many freely available resources for this. Ask questions often when you’re confused by something. It’s good that you asked this question to begin with.

As an aside, an edge case is a rare possibility that should be handleable, but will not usually have to be handled.