We've already talked about the difference between arrays and dictionaries and about what an index and value is. 🤔
Today, I'll be covering the more advanced stuff like inserting new values into a table and more! 👇
How do I GET a value from a table? 🤔
This is what INDEXING means. You use the "key" that you put into the table to get its value. 🔑
Here's how it works for arrays 👇
It is the same for dictionaries, just a string or boolean instead of the number (and other types) ✅
Like this 👇
SETTING a value in a table is the same as with variables 👍
A little bit difficult to explain with words, but here it is in code 👇
But how do we completely remove something from a table? ❌
Well, we can just SET it to NIL ⚪
So now that you know the basic things, let's get onto our next topic - the Table library 📚
I am going to explain everything in simple terms for now and we'll revisit it in a future thread 👍
👇
In case you don't know what a library is, it's basically a LIST or a TABLE of a bunch of functions that have something in common - for example a Math library would be used for numbers 🔢
👇
Well this "table" library is used for - you guessed it! - tables! 👏
And here are the most common and useful functions 👇
✅ table.insert - This function is used to INSERT a new value to a position in an ARRAY. It would be hard to rearrange the indexes manually, so this function does it for you.
❌ table.remove - Removes an index from the table.
🔎 table.find - Finds a value in the table and returns its position
Some of these functions only work for arrays 🤔
That's it for tables today 🎉
Tomorrow's thread is going to be about WHILE LOOPS, so if you want to learn that, follow @notactulurus ✨
👇❗
If we surpass @AntcarTweets in followers by the end of this month, my last follower gets 1k ROBUX 💸
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Variables - their purpose is to store data inside a script. 🗃️
They consist of a name and a value. 🤔
Their name is used to ACCESS the variable (read or write) and their value can be a number, string, boolean or even a table. I'll go over all the types later 👇
The name of a variable can contain any alphanumerical characters, but must NOT START with a number! 🔢