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

Can a table be stored in an IntValue Instance?

Asked by 3 years ago

So I want to know if you can do this, lt will help me a lot. Will something like this work?

local list = {"A", "B", "C", "..."}

local value = Instance.new("IntValue")
value.Value = list
print(value.Value[1])

2 answers

Log in to vote
1
Answered by 3 years ago

No. As the name suggests, it only accepts an int value. One way you could make a table and store it in the explorer could be creating a folder with the name of the table, looping through the table, and creating the appropriate value to the type of the table member. You can find the type of a variable using type(foo) for built-ins (string, int, bool, etc.) and typeof(bar) for those exclusive to rbx.lua

Ad
Log in to vote
1
Answered by 3 years ago

An IntValue explicitly takes a number in it's value, you can't put a table in it like that. Int stands for Integer which basically means a number without decimals.

0
Exactly. You could use a folder with int values in it however it can be easily manipulated client-side. There must be other ways to achieve what you're looking for, i'd just stick to tables and not actual instances to store values. LeHelary 142 — 3y
0
You can put the length of the table or a single value from the table or a concatenation of all values inside the table (Int's) killerbrenden 1537 — 3y

Answer this question