-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tables doc #3239
tables doc #3239
Conversation
@@ -0,0 +1,76 @@ | |||
--- | |||
Title: 'Tables' | |||
Description: 'luau is a scripting language particularly for Roblox game development. This document is meant to demonstrate the use case for luau tables.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[proofreading] Consider briefly defining tables as opposed to luau. It'll help make the entry more cohesive.
Description: 'luau is a scripting language particularly for Roblox game development. This document is meant to demonstrate the use case for luau tables.' | |
Description: 'In the context of luau and Roblox, tables are data types that can store any types of value.' |
local table = {} | ||
``` | ||
|
||
In the context of Lua, the local keyword is primarily used to declare local variables. It is not used specifically for instantiating tables. You can use the local keyword to create local variables of various types, including tables, numbers, strings, functions, and more. What creates the table is the curly braces in the syntax ({}). If you wanted to instantiate a table with parameters you can write something like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[proofreading] Since tables are being discussed in a Luau context, consider using that instead of Lua. Also, hyperlink the word to help readers see the connection more.
In the context of Lua, the local keyword is primarily used to declare local variables. It is not used specifically for instantiating tables. You can use the local keyword to create local variables of various types, including tables, numbers, strings, functions, and more. What creates the table is the curly braces in the syntax ({}). If you wanted to instantiate a table with parameters you can write something like this: | |
In the context of [Luau](https://www.codecademy.com/resources/docs/luau), the local keyword is primarily used to declare local variables. It is not used specifically for instantiating tables. You can use the local keyword to create local variables of various types, including tables, numbers, strings, functions, and more. What creates the table is the curly braces in the syntax ({}). If you want to instantiate a table with parameters you can write something like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @a-m-lamb! :) Your PR is off to a great start! :) I just gave some tips on how you can improve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made another suggestion.
### Accessing Items | ||
|
||
|
||
If your table is set up like an array, an important thing to note is that the index begins at 1 rather than at 0 as it is for other languages. Let's use this table as an example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. I'm not seeing a path for dictionary documentation. Does that not exist yet? lol Should I just create a hyperlink for each datatype?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @a-m-lamb! :) Now you just a review from @SSwiniarski and then another review from a different maintainer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-m-lamb I've completed my initial review. Please update the entry, and tag me when you've finished making changes. Thanks
Calling items from a table when it's formatted like a dictionary is a little different. You can get the value of items by the keys. Below is an example of how you can get the username value from the profile table. | ||
|
||
``` | ||
//creating the profile table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code blocks should use 2 spaces for indentations, not tabs. Comments should have a space and begin with a capital -
// Printing the username in the table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I do agree
Co-authored-by: caupolicandiaz <caupolicandiaz@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-m-lamb For the sake of moving this entry along I went ahead and made the changes directly. This is ready for a second review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-m-lamb, @caupolicandiaz I made one small change and it looks good to go.
👋 @a-m-lamb 🎉 Your contribution(s) can be seen here: https://www.codecademy.com/resources/docs/luau/tables Please note it may take a little while for changes to become visible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree
Calling items from a table when it's formatted like a dictionary is a little different. You can get the value of items by the keys. Below is an example of how you can get the username value from the profile table. | ||
|
||
``` | ||
//creating the profile table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I do agree
Description
Type of Change
Checklist
main
branch.