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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 03 Jun 2014 06:13 AM |
| Just change the "script.Parent.TextLabel.Text" part. :) |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
|
| 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
|
  |
| 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 |
|
|