API:loadstring

Returns a compiled string as a function.

Arguments

 * string
 * string - String to be compiled.
 * chunkname
 * string - chunkname is used as the string's designation for error messages and debug information. When absent, it defaults to "=(load)".

Returns

 * function
 * function - If there are no errors, returns the compiled string as a function; otherwise, returns nil. The environment of the returned function is the global environment.
 * error
 * string - If there are no errors, returns nothing; otherwise, returns the error message.

Example
Runtime Error - This example returns a function, but that function throws an error when called: Compile Time Error - This returns nil and an error string, but the error is not propagated, and is printed to the chat frame: No Errors - This example returns a function, and causes your character to sit or stand:

Related Functions

 * dofile
 * load
 * loadfile
 * RunScript