Title says it all, how do I make a loadstring create a global function that can be used by the rest of the script?

Here's an example:

local equation = 'a + b'
	loadstring('function add(a, b); return '..equation..';	end')()
print(add(1, 2))

Not sure where the error is targeting to.

Alternatively, using loadstring for a function also doesn't work:

local equation = 'a + b'
function add(a, b)
	loadstring('return '..equation)()
end
print(add(1, 2))

The loadstring doesn't recongize the given parameter.

So is there a way to make this work? If there isn't, why?