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

Call values in a table?

I have a table with these values:

  data[plr.Name] = {
            Gold = 200,
            Ruby = 10
        }

whenever i use these:

data[plr.Name].Gold
data[plr.Name]["Gold']

they come out nil both times. How do i call on these values?

1 answer

http://wiki.roblox.com/index.php?title=Global_namespace/Table_manipulation&redirect=no#table.insert

local tablename = {'player'}
 
local vector = Vector3.new(1, 2, 3)

table.insert(list, vector) -- inserts vector into the tablename
 
for i = 1,#tablename do
	print(tablename[i]) -- prints all the names from tablename
end
name = {'roblox', 'shedletsky'} -- roblox is first which is 1, shedletsky is seconds which is 2
print(name[1]) -- prints roblox
print(name[2]) -- prints shedletsky

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