tables doc by a-m-lamb · Pull Request #3239 · Codecademy/docs (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation33 Commits9 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

a-m-lamb

Description

Type of Change

Checklist

@a-m-lamb

@CLAassistant

CLA assistant check
All committers have signed the CLA.

CBID2

@@ -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.'

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.'

CBID2

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:

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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, good point

CBID2

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.

@a-m-lamb

@a-m-lamb

CBID2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made another suggestion.

a-m-lamb

### 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:

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?

@SSwiniarski SSwiniarski linked an issue

Sep 13, 2023

that may beclosed by this pull request

3 tasks

@a-m-lamb

@a-m-lamb

CBID2

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.

CBID2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done

caupolicandiaz

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I do agree

@yangc95 @caupolicandiaz

Co-authored-by: caupolicandiaz caupolicandiaz@gmail.com

@caupolicandiaz

caupolicandiaz

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.

@SSwiniarski

SSwiniarski

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SSwiniarski

@github-actions

👋 @a-m-lamb
You have contributed to Codecademy Docs, and we would like to know more about you and your experience.
Please take a minute to fill out this four question survey to help us better understand Docs contributions and how we can improve the experience for you and our learners.
Thank you for your help!

🎉 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.
If you're appearing as anonymous and want to be credited, see here.

Letsgoque

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I do agree

Reviewers

@Letsgoque Letsgoque Letsgoque left review comments

@caupolicandiaz caupolicandiaz caupolicandiaz approved these changes

@SSwiniarski SSwiniarski SSwiniarski approved these changes

@CBID2 CBID2 CBID2 approved these changes

@KTom101 KTom101 Awaiting requested review from KTom101

@yangc95 yangc95 Awaiting requested review from yangc95