spinywindJoin Date: 2012-01-26 Post Count: 3580 |
^ also how is it used?
|
|
|
A magical place for storing things and many more features >:D
Magic.
|
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
What does the key word "table" do?*
|
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
whats a string lol
|
|
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
hmm i see but how is it used?
|
|
|
Well if everything in that table holds a value to represent something else then it can be manipulated into a game. |
|
|
A common use is just to store a bunch of things into it!
for example:
local players = {} --Empty Table
for _, player in pairs (game.Players:GetChildren()) do --Loop through Players
table.insert(players, player) --Inserts "player" into the tables player
end
Now you have a table of players.
|
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
An entire game? If so can i have an example besides messages?
|
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
Not to sound nooby but i never learned pairs or _, i know how to use for though. Lke iv said many times, im still a beginner.
|
|
|
Well.. Like...
numbers = {1,2,3,4,5}
if (numbers[1]) < 5 then
print("Hello World") |
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
oh i understand. For example. It can detect the amount of players in a game and depending on that number, you can change values and what not. Am i correct?
|
|
|
You can have certain events that manipulate a table to create other events.
for _,part in pairs(workspace.Model) do --so our variable is "part" and it represents everything in workspace.Model
if part:IsA("BasePart") then --if "part" is a Part then
part.BrickColor = BrickColor.new("Crimson")--make it red |
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
What does the Model do exactly in workspace.Model?
|
|
AethexJoin Date: 2011-10-16 Post Count: 2193 |
a table is like this small platform (some are large, usually not too big) sometimes made of wood, stone, or metal (tons of materials like plastic too)
there are different types of tables, usually people put stuff on them
idk where you eat dinner, but if it's a platform with like one big leg in the middle or maybe like 4 legs or something on it then that's a table (probably)
look up "pictures of tables" for more help |
|
|
Do you mean what is a model? |
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
Well when you run "workspace.Model" Are you identifying something as the model. So it could be anything in workspace?
|
|
|
no pairs means children in (workspace.Model) |
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
oh. Cant you just locate the model and use GetChildren instead?
|
|
|
oh sorry it would actually be for _,part in pairs(workspace.Model:GetChildren()) do |
|
spinywindJoin Date: 2012-01-26 Post Count: 3580 |
that makes a lot more since and then you just detect the part and change values and what not depending whether the part IsA Basepart or not.
|
|
|
Sorry you would actually have to add get children. |
|
|
Number = {2,4,6,8,10}
print(Number[2]) --4
----------------
--[[
Example existing players:
izzatnasruna
Anaminus
roblox
builderman
]]
local Players = game:GetPlayers()
print(Players[1]) --izzatnasruna |
|