Actulurus πŸ‘‘ Profile picture
Aug 20 β€’ 14 tweets β€’ 3 min read
πŸ“Œ Daily #Roblox scripting thread 6! ✨

πŸ” FOR-LOOPS #️⃣

πŸ‘‡ A #RobloxDev thread!
πŸ” The for-loop is used to ITERATE a certain number of times.

πŸ€” But what does "iterating" mean?

♻️ It means for the loop to "run" or "refresh"
2️⃣ There are two use cases for the for-loop

πŸ” The first one is to loop, or iterate, a set number of times.

πŸ‘‡ This is how:
⌨️ Type "for i =" followed by three numbers separated by a comma.

1️⃣ The first one is the START VALUE - the variable i will be equal to this number when the loop starts.
2️⃣ The second one is the GOAL VALUE - the loop will repeat until the variable i is equal to this number.
3️⃣ And the third one is the INCREMENT - Every iteration, the variable i will be increased by this value.

❓This value is optional and defaults to 1.

Here's how it all looks πŸ‘‡
πŸ“ Please note that "i" is a variable, meaning you can call it whatever you want. It's also only readable INSIDE the loop!
️⃣ The second use case of the for-loop is to ITERATE over a TABLE.

Here's how that looks πŸ‘‡
⌨️ Type "for i, v in Table do", replacing "Table" by the array or dictionary that you want to loop through.

Like this πŸ‘‡
What this does is that it runs ONCE for every index/value paid in the provided table. πŸ€”

The variables "i" and "v" are equivalent to the index and value respectively. πŸ‘
πŸ’‚ A really good way to remember this is to translate it into English:

πŸ‘‰ "For each index and value pair in the table, do this:"
πŸ‘ That's it for today. Tomorrow's thread is going to be about the REPEAT-UNTIL loop, so if you wanna learn that, follow @notactulurus ✨
Was this thread helpful?
I'm also doing a 5k R$ giveaway, where EVERYONE has the SAME CHANCE to win! πŸ’Έ

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Actulurus πŸ‘‘

Actulurus πŸ‘‘ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @notactulurus

Aug 18
πŸ“ŒDaily #Roblox scripting thread 5!

βœ… WHILE LOOPS πŸ”

A #RobloxDev thread πŸ‘‡
While loops, or "while-true-do" loops, are one of the simplest loops in Lua. ✨

They're like if-statements, but they check the condition infinitely until stopped. πŸ”

Here's an example πŸ‘‡ Image
If the condition is true, the code inside the loop will run. πŸ‘

If it's false, the loop will check again the next frame! πŸ”

This means that any code AFTER the loop will NEVER run, unless the loop is stopped. ❌
Read 8 tweets
Aug 18
πŸ“Œ Daily #Roblox scripting thread 4!

#️⃣ TABLE INDEXING AND MORE πŸ”’

πŸ‘‡ A #RobloxDev thread!
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 πŸ‘‡ Image
Read 14 tweets
Aug 16
πŸ“Œ Daily #Roblox scripting thread 2!

πŸ—„οΈ VARIABLES πŸ—‚οΈ

πŸ‘‡ A #RobloxDev thread! Image
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! πŸ”’

It can also include an underscore βž–
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(