Easy Written By anthlons

Basics of Tables Created on: 01-01-2019

Teaches you how to use tables in the simplest way

Tables are very useful, and can save you a ton of time! Look at the comments to see how to use them!

local myTable = {} -- This is a table, it can hold tons of values! I'm going to be showing you how to use it with a string!

What to tables do? Why do I need them? Can't I do this manually?

[1] Tables hold all kinds of data. Strings, booleans, number values, etc. You'll see them alot with looking at other code as some common purposes are;

Checking to see if a player is banned in a server, Checking if the player is an administrator, Creating values inside somewhere.

[2] You are going to need them alot of the times (Proceed to [3] for related info.)

Tables, are often used to make things alot more organised. Lets say you want to make a player an admin. You dont want to say; if plr.Name == 'AdminHere' or plr.Name == 'AnotherAdminHere' then

It just isnt needed! Thats where tables come in!

Instead of constantly writing that line of code to admin a player, you can use a table to specify them

(Examples will be in the Scripting Portion of the tutorial.) [3] Yes, as stated in [2] you can indeed do this manually, but no one wants to write that line of code over and over again! That'll be boring and utterly useless.

--SCRIPTING--

local myTable = {'wayIxn', 'RandomPerson', 'Friend'} -- These are strings, used for getting the name, or text.


-- Lets say you want to print the 3rd value in the table, which is 'Friend'

print(myTable[3]) -- This prints the third value in 'myTable', which you can see is 'Friend'

Output;

Friend

Easy Written By anthlons

See anthlons's profile on Roblox

Discussion