#problem with tables

1 messages · Page 1 of 1 (latest)

scarlet ruin
#

so basically i have 6 buttons, all named like in tables, skill variable = button.Name, but in table you need quotation marks for so like skill variable its SkillCash, but i need "SkillCash", how do i put quotation marks in variable?

Skills = {
                    ["SkillPoint"] = 0;
                    ["SkillCash"] = false;
                    ["SkillCash2"] = false;
                    ["SkillCash3"] = false;
                    ["BetterQuest"] = false;
                    ["PassiveCash1"] = false;
                    ["PassiveCash2"] = false;
                    ["RerollUpgrader"] = false;
                    ["PassiveSpawn"] = false;
                    ["GradeMultiply1"] = false;
                    ["GradeMultiply2"] = false;
                    ["GradeDiscount"] = false;
                }
local function SkillChanged(Player,skill)
    print(Skills[skill])
    Skills[skill] = true
    print("changed Skill")
end
dry anvil
#

string?

scarlet ruin
#

how to do it? like how do i put variable in quotation marks, maybe im dumb

dry anvil
#

local Variable = "this is a string"

#

now the variable has a string value

scarlet ruin
dry anvil
#

local Skill = "whatever text you need in here"

scarlet ruin
#

so i need from PassiveCash1 to "PassiveCash1"

dry anvil
#

then use ' "PassiveCash1" '

#

u mean convert variable name to string?

#

im kinda confused

scarlet ruin
# dry anvil u mean convert variable name to string?

maybe cuz of my bad english i cant fully explain, but i have Skills table, skill value is name of buttons, if i do Skills[skill], it will be Skills[PassiveCash1], but for access to table i need Skills["PassiveCash1"]

shadow kelpBOT
#

studio** You are now Level 8! **studio