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: Um, table?

Previous Thread :: Next Thread 
Orced is not online. Orced
Joined: 08 Apr 2010
Total Posts: 1301
03 Jun 2014 04:55 AM
tab = {[[ This is string one ]]; [[ This is string two]]}
CurrentString = 1
while true do
Gui.TextLabel.Text = tab[CurrentString]
wait(1)
end


12:53:38.010 - String expected
12:53:38.011 - Script 'Players.Player1.PlayerGui.ScreenGui.TextLabel.Script', Line 43
12:53:38.012 - Stack End
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
03 Jun 2014 05:26 AM
I don't know which line is the line 43 so I won't even bother.
Report Abuse
GeneralUserInterface is not online. GeneralUserInterface
Joined: 25 May 2011
Total Posts: 26
03 Jun 2014 05:59 AM
I think the tab[CurrentString] part didn't see it as a string, did you use ""? So that it will be recognized as a string. I made an experiment with this one and mine worked. Here's what I did:

tab = {"Text 1","Text 2"}

CurrentString = 1

while true do
script.Parent.TextLabel.Text = tab[CurrentString]
wait(1)
end

idk. I'm a newbie to scripting but I tried to help, so I hope it helped?
Report Abuse
GeneralUserInterface is not online. GeneralUserInterface
Joined: 25 May 2011
Total Posts: 26
03 Jun 2014 06:13 AM
Just change the "script.Parent.TextLabel.Text" part. :)
Report Abuse
Orced is not online. Orced
Joined: 08 Apr 2010
Total Posts: 1301
03 Jun 2014 06:26 AM
na, I fixed the problem.

The problem was in my table, because I used
tab = {[[ string ]]}

and I needed
tab = {[
[[ string ]]
] = 1;}
Report Abuse
GeneralUserInterface is not online. GeneralUserInterface
Joined: 25 May 2011
Total Posts: 26
03 Jun 2014 06:39 AM
Glad it's now fixed :)
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
03 Jun 2014 07:47 AM
Oh my.
This is very nice to know.

The reason it yelled at you is because you use bracket notation for strings. In tables, however, brackets are used to specify string keys like ["Key"]. Because you had brackets, it tried to interpret [ string ] as a string, which we all know is not a string (in fact, it doesn't make sense in Lua). This is why you needed that extra bracket.

To fix this, you would have just had to use single or double quotes, or add another 'layer' of brackets and assign them a value (like you did).
Report Abuse
Orced is not online. Orced
Joined: 08 Apr 2010
Total Posts: 1301
03 Jun 2014 02:19 PM
Actually, I needed the [[ ]] brackets to hold a huge text. I was about to write a book based on this system and yet, having troubles with the page system.
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