Convert String into Arithmetic Operator
snippet in lua

Convert String into Arithmetic Operator

user8073

local execute = {
  ['+'] = function (x, y) return x + y end,
  ['-'] = function (x, y) return x - y end,
}
print(execute['+'](2, 2) == 4)