Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Does roblox have an array object?

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?

2 comments

0

So what your asking is that is it possible to put sound ids' in a StringValue?

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.

1 answer

✓ Accepted answer

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.

2 comments

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?

0

There is not, sorry. I assumed this was what you were asking about, since this site is called ScriptingHelpers, after all. You could store the data as a JSON-formatted String, which only takes one function call to convert into a Lua Table.

This discussion is preserved as it was. New answers, comments, and votes are closed.