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 » Scripting Helpers
Home Search
 

Re: How to print the first value of a table?

Previous Thread :: Next Thread 
Typocrite is not online. Typocrite
Joined: 28 Aug 2013
Total Posts: 6856
04 Jul 2014 08:00 PM
But the values are variables, not numbers.

Table = {variable1, variable2}

How to print variable1?
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
04 Jul 2014 08:03 PM
print(Table[1])
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
04 Jul 2014 08:06 PM
for i,v in pairs(Table) do
print(i.."=="..v)
end

or

for i = 1,#Table do
print(Table[i])
end
Report Abuse
Typocrite is not online. Typocrite
Joined: 28 Aug 2013
Total Posts: 6856
04 Jul 2014 08:06 PM
I tried that. Doesn't work.

And I printed the variables beforehand so I am sure the variables are defined.
Report Abuse
blox6137 is not online. blox6137
Joined: 23 Nov 2008
Total Posts: 1109
04 Jul 2014 08:12 PM
wait wut?

print(variable1)

System32? Delete it.
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
04 Jul 2014 08:14 PM
Den wut r u doin?
Report Abuse
Typocrite is not online. Typocrite
Joined: 28 Aug 2013
Total Posts: 6856
04 Jul 2014 08:16 PM
I figured it out- the issue was that I was trying to concatenate it

oesia = oigwge[1]
print("ewiong"..oesia.."" )

this was what I was doing but apparently you can't do that.
Report Abuse
blox6137 is not online. blox6137
Joined: 23 Nov 2008
Total Posts: 1109
04 Jul 2014 08:18 PM
print(variable1 .. variable2)
PS, what is oeasia, and oigwge and ewiong.

System32? Delete it.
Report Abuse
Typocrite is not online. Typocrite
Joined: 28 Aug 2013
Total Posts: 6856
04 Jul 2014 08:21 PM
That was me typing gibberish just to demonstrate what I was doing
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
04 Jul 2014 08:36 PM
Typo, why the fk did use a put .."" at the end. You don't need that and to be honest, it jut pisses me off.
Report Abuse
Typocrite is not online. Typocrite
Joined: 28 Aug 2013
Total Posts: 6856
04 Jul 2014 08:44 PM
It's called string concatenation

this is where you pause a string and substitute a value in place so that the string is more dynamic

e.g.

"player 1's name is"..game.Workspace.Players.PlayerName..""

That example doesn't work but you get the idea
Report Abuse
blox6137 is not online. blox6137
Joined: 23 Nov 2008
Total Posts: 1109
04 Jul 2014 09:44 PM
You're not concatenating correctly bro.

System32? Delete it.
Report Abuse
Vuva is not online. Vuva
Joined: 22 Jan 2010
Total Posts: 1102
04 Jul 2014 09:56 PM
No he is talking about the ending

"Hello ".."World!"..""
is the same as:
"Hello ".."World!"
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
05 Jul 2014 06:46 AM
I just noticed what I typed lmao.

And Vuva is correct, thats what I meant. I have when people do the '..""' at the end. It's un-needed and just makes the script ugly qq Look at this code that my friend uses:

game.Players.PlayerAdded:connect(function(player)
local magic = Instance.new("StringValue")
random_magic = {"Fire Dragon Slayer",
"Flame Dragon Magic",
"Flame God Slayer",
"Ice Devil Slayer Curse",
"Iron Dragon Slayer",
"Jade Dragon Magic",
"Lightning Dragon Slayer",
"Lightning God Slayer",
"Mother Dragon Magic",
"Poison Dragon Slayer",
"Shadow Dragon Slayer",
"Sky Dragon Slayer",
"Sky God Slayer",
"White Dragon Slayer"}
local ele = math.random(1,#random_magic)
local element = random_magic[ele]
magic.Name = "Magic"
magic.Value = element
magic.Parent = player
player:WaitForDataReady()
player:SaveString(""..player.Magic.Value.."", player.Magic.Value) -- ewwww
end)
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
print(player:LoadString(""..player.Magic.Value.."")) -- ewwwwwww
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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