Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What does the {} mean in Lua?

1 answer

Complete overview


Tables

What you're referring to is known as a table (or, object). Everything in your game is an object, which is a hierarchy of different methods (special functions), properties, and states.


Whether or not you think of the objects in your game as tables, that's actually the perfect description for them. In fact, the essence of everything in your game belongs to the concept of object-oriented programming (also referred to as OOP). Notice the term "object" in that phrase, that's very important.

Terminology


There's a lot of new terminology behind all of this, but the logic behind it is really quite simple. A table is just something that holds information. What you can do with that information once you've stored it however, is where the beauty of tables is illuminated.

Reading: The process of using, retrieving, or working with stored information in a table, is when you "read" a table.

Writting: The process of writing information, overwriting information, or changing information, is called "writing" to that table.

Object-oriented programming: OOP is pretty self-explanatory. It's a form of programming in which everything is object-oriented, meaning you have a set of classes to work with. Now, I could go further into this with inheritance, subclasses, superclasses, ect, but I'll spare you the strain. Instead, if you'd like to know more about how OOP works, I'd suggest going here: http://searchsoa.techtarget.com/definition/object-oriented-programming

Object: I know I said tables can be referred to as objects, which they can (since they are), however objects can also reference other other data types as well. For instance, an object could be a variable, a function, a thread, and the list just goes on depending on the language you're working with.

Extra sources

I'd love to explain more on how tables work, but I'm pretty sure I covered all the basics about them here: https://scriptinghelpers.org/questions/28182/how-to-learn-tables#31632

Here's another link to an introduction to tables: https://www.lua.org/pil/2.5.html


But if you have any further questions, just let me know.

1 comment

0

You have just assaulted him with information.

This discussion is preserved as it was. New answers, comments, and votes are closed.