What is the difference between Lua and Luau?

At the beginning of my development progress in the Roblox platform, I only could design and build architectures for personal projects while using for the most part free models/tutorials on how to create systems that allows specific things to happen as expected… Yet, I decided to myself that it is best to learn to code and understand the structures, problems, and so much more to comprehend. Currently, I understand how to code and read lines using the programming language Lua and always finding ways to improve as well as learn the articles of Roblox Documentation to test/apply (in situations where it is safe to say).

However, ever since Luau came out in 2019, this begins to make me confused as never heard of it or not understanding what and how you can create codes using it:

I have tried one time asking internally for responses regarding it, but couldn’t manage to get a conclusion. Same as going to the Roblox website specifically for the new creation… :grimacing:

Therefore, I would like to have a little help from those that have the knowledge and possibly to answer my puzzle regarding the differences between Lua and Luau. I am going to be very happy to hear more!

Thank you.

5 Likes

The main difference between Lua and Luau is that Luau has a number of performance optimizations that make it faster and more efficient than regular Lua. This can result in better performance for games and other experiences developed on the Roblox platform.

In addition to performance improvements, Luau also includes some new features and functionality that are not available in regular Lua. For example, Luau includes improved type checking and type inference, which can help catch errors earlier in the development process.

If you already know how to program in Lua, you should be able to learn Luau relatively easily. Many of the basic concepts and syntax are the same, although there are some differences in how certain things are implemented.

3 Likes

I see now and believe I got the context needed! Moreover, I think it is the best for me to learn about type checking and type inference as it seems to be primary topics for Luau.

@zahra_y735 Is it good to check out all of the recaps from 2019 to 2023 or at least see the essentials? I know it may be a silly question to ask, but as this was developed years ago, I am not too sure where to start regarding the new features…

Luau’s main focus was for much needed optimizations to the Lua VM and to add more complex type checking, which allows you to see more in-depth errors before runtime.

You can specify the type of a given variable yourself, or you can have Luau infer the type for you.

If you want to use Luau strictly, you must add a --!strict tag at the top of your scripts. By default, you have to specify if you want to use Luau.

Luau is really no different than Lua besides some new keywords, like export or type (not to be confused with the type function) and it will not hinder with game development even if you’re already well acquainted with regular Lua but not at all acquainted with Luau.

If you want to dive deeper into Luau for your games (which by the way I 100% recommend you do, it not only makes things faster & more efficient, but makes it easier to understand for yourself and more fail-safe), you may check out the documentation for Luau here: Getting Started - Luau

3 Likes

Thank you for the information @veilict! Much appreciated! Although, I am still concerned about this:

The documentations got you there. You don’t necessarily have to look at any recap, as in the circumstance you need usage information or information in general, you can just seek the documentation for that and it will answer [nearly] all possible questions.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.