Parses the string and returns the compiled chunk as a function. Does not execute it.
If the string cannot be parsed returns nil plus an error message.
The optional debugname is used in debug error messages.
f = assert (loadstring ("print 'hello, world'"))
f () --> hello, world
You can avoid the intermediate variable "f" in this example by simply putting the brackets on the same line:
assert (loadstring ("print 'hello, world'")) () --> hello, world
If the string was produced by string.dump, loadstring converts it back into the original function.
function f () print "hello, world" end
s = string.dump (f)
assert (loadstring (s)) () --> hello, world