Function:

```
math.sum = function(variable, from, to, condition)
local n = 0
for i = from, to do
print(variable, i)
local c = condition:gsub(variable, i)
print(c)
n = n + tonumber(c)
end
return n
end
```

In Main:

```
print(math.sum("n", 1, 35, "1/n^n"))
```

Error:

```
Math:8: attempt to perform arithmetic on a nil value
stack traceback:
Math:8: in function 'math.sum'
Main:8: in function 'setup'
```