Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does roblox have an array object?

Asked by 9 years ago

I am making a music player and I need to store all of the songs id's. I know there are String Value but this cannot store an array.

How can I store the song id's which also need to be individual to the client/user?

0
So what your asking is that is it possible to put sound ids' in a StringValue? woodengop 1134 — 9y
0
StringValue has a limit (200,000 characters) each time a player makes any changes all of this data would then have to be read into a table then used and then converted back which will be a bad solution but it can be done. User#5423 17 — 9y

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

Lua has structures called Tables, which are more like Structs than anything else but behave like arrays when you want them to:

songIds = {1251366, 136134727, 125134, 1251366} 

As for having different stored IDs for each player, the solution to that depends on what you're doing with this data.

0
Is there an alternative so that this is not in a script? ie The id's are not hard coded so that they can be changed? User#5423 17 — 9y
0
There is not, sorry. I assumed this was what you were asking about, since this site is called *Scripting*Helpers, after all. You could store the data as a JSON-formatted String, which only takes one function call to convert into a Lua Table. adark 5487 — 9y
Ad

Answer this question