Hi,
I am just leaning arrays and having issues referencing the data in the array below.
The second test2 below errors not being able to find Description.
Is my code wrong or am I doing the array wrong?
-- Works
print("test1 " .. tostring(QuestData.Q1.Description))
-- Does not work
print("test2 " .. tostring(QuestData["Q" .. playerQuests[0].Description]))
local questData = {
["Q1"] = {
["Level"] = 0,
["NeededProgress"] = 10,
["RewardType"] = "Gold",
["RewardAmount"] = 100,
["Description"] = "Collect 3 Apples",
["Chat1"] = "Can you do my quest",
["Chat2"] = "Find three Apples",
["Chat3"] = "I will reward you with 20 gold"
},
["Q2"] = {
["Level"] = 0,
["NeededProgress"] = 20,
["RewardType"] = "Exp",
["RewardAmount"] = 50,
["Description"] = "Collect 3 Strawberries",
["Chat1"] = "Can you do my quest",
["Chat2"] = "Find three Strawberries",
["Chat3"] = "I will reward you with 20 gold"
},
}