-
What do you want to achieve? Keep it simple and clear!
I want to run functions that are inside a dictionary with use of arguments instead of straightly using the variables. -
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried doing this, but to no avail.
Can you run a function in a table?
local Race = "Raceless"
local Races = {"Dragonborn", "Jhaltar"}
local function ApplyRace(Race)
if Race == "Raceless" then
local chosenRace = math.randomseed(os.time())
chosenRace = Races[math.random(1, #Races)]
Race = chosenRace
end
end
local function DefineTraits(Types)
local randomType = math.randomseed(os.time())
randomType = Types[math.random(1, #Types)]
print(randomType)
end
local RacesInfo = {
["Dragonborn"] = {function()
local Types = {
[1] = {"Blue"},
[2] = {"Red"},
[3] = {"White"},
[4] = {"Silver"},
[5] = {"Gold"},
[6] = {"Bronze"}
}
DefineTraits(Types)
end
},
["Jhaltar"] = {function()
local Types = {
[1] = {"Pastel Brown"},
[2] = {"Pale White"}
}
DefineTraits(Types)
end
}
}
local function Main(Race)
RacesInfo[Race]()
end
ApplyRace(Race)
wait(1)
Main(Race)
This is my first post, thank you in advance for the answers that you’ll be giving.
If my question already has an obvious answer, then I apologize for my ignorance.