I'm trying to make a math equation generator. There will be 2 numbers and one operator(+, -, /, *). I know how to randomly generator the 2 numbers, but I do not know how to randomly pick the operator. Here is my code for randomly picking an operator.
local operators = {'*', '/', '+', '/'}
local operator = nil
local function RandomOp ()
local operator = operators[math.random(#operators)]
end
The problem I have is that the operator is returned as a string. I want to store the answer of the equation as a value, but obviously a string does not function as an operator.
local answer = num1 '+' num2
-- does not work
So is there anyway I can convert the string into its operator

2 comments
https://devforum.roblox.com/t/question-about-a-particular-string-pattern/592171/2
thank you kind sir, have a great day