Hi all, I have a script that looks like below:
function rabbits()
print(1)
end)
function turtles()
print(2)
end)
function startRound(round)
-- I want to call the function that corresponds to 'round'
end
startRound(rabbits)
Is there an easy way to get the rabbits function called from the startRound function? I know I can make a long if then statement, but I'd have 20 elseifs and that would be annoying.
I tried something like;
function startRound(round)
[round]()
end
but I knew that wouldn't work when I was writing it, and it didn't. But I want to be able to do something along those lines. Any help would be great, thanks!

3 comments
This works, but only because 'rabbits' in the 12th line points to the function on line 1. If it were a string, this would not work.
Haha yeah we do know each other. Ill test this when I get home later tonight. :)
Glad I could help!