generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Any tutorials on this?

Previous Thread :: Next Thread 
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
19 Feb 2015 09:43 PM
Are there any tutorials on accessing tables and using them. People seem like Geniuses at tables. The wiki article isn't helping.
Report Abuse
gerov is not online. gerov
Joined: 05 Feb 2011
Total Posts: 5504
19 Feb 2015 09:53 PM
lua.org has some good tutorials.

Why don't you take a seat over there?
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
19 Feb 2015 10:15 PM
Think of tables as storage containers, here's a few examples of how to use them.


Example A:
----------------------------------------------------------------------------------------------
local t = {"Hi, ","table!","this ","is ","a "}
print(t[1]..t[3]..t[4]..t[5]..t[2])

--Output: Hi, this is a table!
----------------------------------------------------------------------------------------------

Example B:
----------------------------------------------------------------------------------------------
local c = part:GetChildren() --returns a table containing all of the part's children

for i = 1,#c do

if c[i]:IsA("Decal") then --checks if the child is a decal
c[i]:destroy() -- removes the decal
end

end
----------------------------------------------------------------------------------------------

( ͡ಠ ͜ʖಠ)
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
20 Feb 2015 06:14 AM
So [x] X is the index?
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
20 Feb 2015 02:48 PM
yes

( ͡ಠ ͜ʖಠ)
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
20 Feb 2015 05:27 PM
Could you go more in depth?

"I like to program." - Bosswalrus
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
20 Feb 2015 05:38 PM
Let's say you were making an admin script. You would put all of the admin's names in a table, then check the player's name based on it. I will provide comments throughout this script to give examples.

local admins = {"LeitrisArcade","bosswalrus","Shedletsky"} -- table containing admin names

for i = 1,#admins do -- #admins stands for how many items are in the table(in this case 3)
if ply.Name == admins[i] then

-- admins[i] means that you are going into the table, and finding the item in the table based on i. If you were to say "admins[1]", then it would see if the player's name was "LeitrisArcade", as LeitrisArcade is the first item in the table.

-- Code to make something happen if the player is an admin

end
end

( ͡ಠ ͜ʖಠ)
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
20 Feb 2015 05:40 PM
Google "programming in lua 2.5" to learn about tables
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
20 Feb 2015 05:43 PM
@LeitrisArcade Thank you.
@Seranok Alright, thanks.

"I like to program." - Bosswalrus
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image